Reputation: 1527
I was trying to run following code in eclipse in ubuntu 12.04 but It keeps giving me error. could you please tell me why this is happening ? Thanks.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
Symbol 'std' could not be resolved Symbol 'cout' could not be resolved Symbol 'endl' could not be resolved
Upvotes: 3
Views: 8576
Reputation: 59
This is the C++ parser of Eclipse who can't find the symbols.
You could add the config to your already created project but it can be painful. So simply create a new C++ project :
File > New > C++ Project
Then :
Pick the type of project you want, like "Executable > Empty Project" (or maybe "Makefile Project > Empty Project") and make sure to select Linux GCC in the Toolchains. This will add all the default includes in the configuration so that the C++ parser finds everything. Click Finish, paste your code in a C++ file and enjoy.
For information, you can see these include paths in the Project Properties > C/C++ General > Paths and Symbols > Includes > GNU C++.
Upvotes: 5