Eclipse CDT C++ error

11,164

Solution 1

You need to add the paths to the std libraries to your project in eclipse. It seems that somehow eclipse did not find your std library. You need to add the path to your gcc include under:

properties->C/C++ General->Paths and Symbols->Includes->GNU C and GNU C++

The paths GCC/G++ uses can be found by the commands in this answer to "Where does gcc look for C and C++ header files?".

Solution 2

Install the GNU C++ Compiler g++, using the command:

sudo apt-get install g++

Solution 3

In my case (I am using TDM GCC installed on a non-standard location on Windows), I had to add the Path variable to the project. I did it by Project->Properties->C/C++ build->build variables. The value to the Path variables are auto read when one clicks on add and then select Path from the drop down list. Once the Path variable is added the C/C++ index needs to be rebuild.

Solution 4

Requires a restart of eclipse to be active.

Share:
11,164
Phil
Author by

Phil

Updated on July 25, 2022

Comments

  • Phil
    Phil almost 2 years

    I have just installed Eclipse CDT on my machine for developping C++ applications.

    I have created a new C++ project. I have copied a cpp file.

    When I click the build button, the project compile without errors.

    However, I have a problem. The problem is that Eclipse tell me that there is many errors. For example Eclipse show that "using namespace std" is an error or that "#include " is an error.

    I don't know what is the problem with Eclipse because my file compile properly when i click the "build" button.

    Is there some settings that I did not set properly?

    Thanks!

  • NickyP
    NickyP over 12 years
    just now saw Index Rebuild that will likely do the same thing as a restart.