Right tried again, I had it set to Build Automatically so didn't get the build error but got the error
Description Resource Path Location Type
Symbol 'cout' could not be resolved brandnew.cpp /Brand New line 5 Semantic Error
Code I used wasCode:#include <iostream> int main() { std::cout << "Hello World!\n"; return 0; }
Ok I did
cd Brand\ New
Then I wrote
g++ -o brandnew brandnew.cpp
and I got no response at all. So I tried
g++ -o brandnew.cpp
and I got the error
Code:g++: fatal error: no input files compilation terminated.
g++ will give no response if compilation succeeds - basically that means there were no errors and it was able to resolve std::cout correctly
Unfortunately
probably overwrote your source code file (-o means output so it will try to create the executable program but give it the name 'brandnew.cpp' instead of plain 'brandnew')Code:g++ -o brandnew.cpp
I suggest creating the .cpp file again, running
and then checking if the executable was producedCode:g++ -o brandnew brandnew.cpp
and if so trying to run itCode:ls -l
BTW if your IDE uses Makefiles under the hood you may run in to trouble if your build directory name contains spaces - just a heads upCode:./brandnew
Last edited by steeldriver; November 24th, 2012 at 08:45 PM.
Oooooo excellent that worked I was able to finally see Hello World!
Ok I'll make sure I leave out the spaces now.
Right it seems I've done something funny in terms of IDEs in Eclipse. Is there a way to fix this so I don't have to use terminal and can infact just run the programs in Eclipse ?
Ok very strangly after doing that in terminal it now builds fine and returns Hello World! in Eclipse as well now.
Thank you all very much for your help.
Bookmarks