Eclipse 3.7.0 Indigo with CDT shows many false compilation errors

zonyitoo picture zonyitoo · Nov 1, 2011 · Viewed 15.7k times · Source

I have updated my Ubuntu box to 11.10 and then Eclipse also have been updated to 3.7.0 Indigo with CDT 8.0.1

Then the following problem occurs:

Eclipse errors

I have included the vector header file but the compiler said that Symbol 'vector' could not be resolved. I also defined #define int Comparable, but Eclipse also said Symbol 'Comparable' could not be resolved and so on....

Although lots of errors occur, compiling was finished successfully!

I have tried to use g++ to compile the code, it had no problem.

Answer

Catskul picture Catskul · Dec 20, 2011

The problem is that there are a bunch of include directories that are missing from the indexer's perspective.

Adding the following worked for me, but may depend on your particular setup where they actually exist:

/usr/include/c++/4.6.1
/usr/include/                
/usr/include/c++             
/usr/include/c++/4.6         
/usr/include/x86_64-linux-gnu
/usr/include/asm-generic
/usr/include/c++/4.6.1/x86_64-linux-gnu/

They can be set in Project>Properties>C++ Include Paths

Presumably, in the future, the platform specializations for the CDT will included these automatically. I recall reading that somewhere, but cannot provide a reference.