0

I have recently installed Eclipse Luna in Linux.

Then, I have created a new project for testing "Hello World" in this following process.

<New C++ Project - Empty Project - Linux GCC - new source file>

I wrote

#include <iostream>
using namespace std;

int main() {
    cout << "!!!hate this!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

You can see what I wrote in the .cpp file. However, I have some errors that I can't solve:

Symbol 'cout' could not be resolved lol.cpp /hyojung    line 13 Semantic Error
Symbol 'endl' could not be resolved lol.cpp /hyojung    line 13 Semantic Error
Symbol 'std' could not be resolved  lol.cpp /hyojung    line 10 Semantic Error

I don't understand why these errors happen.

Andreas Fester
  • 36,091
  • 7
  • 95
  • 123
  • Try to use a good editor (`emacs`, `gedit` ....). Then compile on the command line (probably with `g++ -Wall -g lol.cpp -o hello`). Then try running `./hello`; at last learn how to use the debugger: `gdb hello`; Eclipse is a loss of time in your case. – Basile Starynkevitch Sep 19 '14 at 09:05
  • 2
    @BasileStarynkevitch While I think that emacs is challenging and adds too much unknowns for a newbie (as I assume), I'd be interested why you'd consider Eclipse a loss of time. (I have not programmed much C++ with it but would assume it's well established forit.) – Peter - Reinstate Monica Sep 19 '14 at 09:26
  • 1
    Compiles fine for me: http://ideone.com/ubLguC of course your code isn't 13 lines long, is there anything else in your code? – Baldrickk Sep 19 '14 at 09:31
  • Do you have your include paths set correctly. http://stackoverflow.com/questions/10803685/eclipse-cdt-symbol-cout-could-not-be-resolved – acraig5075 Sep 19 '14 at 09:33
  • 1
    @PeterSchneider: Eclipse is a nice IDE, but IMHO it may be hard to configure. Going back to command line compiling may help to state if the problem is in eclipse or in the code. In present case, code **is** correct, so if it works when compiled from command line the problem is in Eclipse config, if not it is in gcc installation. – Serge Ballesta Sep 19 '14 at 09:40
  • @OP You may try to switch of static analysis options in Eclipse. These aren't really errors. – πάντα ῥεῖ Sep 19 '14 at 09:42

0 Answers0