Eclipse CDT C ++ Error

I just installed the Eclipse CDT on my c ++ application development machine.

I created a new project in C ++. I copied the cpp file.

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

However, I have a problem. The problem is that Eclipse tells me that there are many errors. For example, Eclipse shows that “using the std namespace” is an error or that “#include” is an error.

I do not know what the problem is with Eclipse, because my file compiles correctly when I click the "build" button.

Are there any settings that I did not set correctly?

Thanks!

+6
source share
4 answers

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

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

Ways to use GCC / g ++ can be found by the commands in this answer to "Where does gcc look for C and C ++ header files?" .

+8
source

A restart of the eclipse is required to activate.

+1
source

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

 sudo apt-get install g++ 
+1
source

In my case (I am using TDM GCC installed in a non-standard location on Windows), I had to add the Path variable to the project. I did this using the variables Project-> Properties-> C / C ++ build-> build. The value for the Path variables is automatically read when you click the Add button, and then select Path from the drop-down list. After adding the Path variable, you need to rebuild the C / C ++ index.

+1
source

Source: https://habr.com/ru/post/900821/


All Articles