Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to set up the GNU C++ COMPILER, but I get an error I don't understand when I try to compile hello.cpp
    text
    copied!<p>So I bought this book called <a href="http://rads.stackoverflow.com/amzn/click/1840784326" rel="nofollow noreferrer">C++ Programming In Easy Steps by Mike McGrath</a> online. </p> <p>In the instructions it specifies to create a source file written in C++, the infamous "helo world". So I created my cpp file through sublime text editor and moved it to a file called MyPrograms in my C directory. The code is as follows:</p> <pre><code>#include &lt;iostream&gt; using std::cout; using std::endl; int main() { cout &lt;&lt; "hello world"&lt;&lt; endl ; return 0 ; } </code></pre> <p>I have also tried: #include using namespace std;</p> <pre><code>int main() { cout &lt;&lt; "hello world"&lt;&lt; endl ; return 0 ; } </code></pre> <p>Ok so I saved this file as hello.cpp in C:\MyPrograms. Then here is where the error occurs.... I open cmd. I do "c++" I receive the message "c++: no input files".Which is what I'm supposed to recieve according to the book. I proceed to do "cd\myprograms" to enter into the MyPrograms directory. Once in that directory I do "c++ hello.cpp". According to the book this is supposed to compile my source file and create an executable file next to it. Instead I get a long error message that end in collect 2: 1d returned 1 exit status.</p> <p>When I visit MyPrograms no executable file has been made next to the original cpp file. I have also tried to do "c++ hello.cpp -o hello.exe" but it gives me the error again. All of this is done on the command prompt. <img src="https://i.stack.imgur.com/C1gqc.png" alt="The command prompt error"></p> <p>Please help :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload