Eclipse CDT indexer – how to solve unresolved includes

eclipse-cdtindexer

I have a workspace with multiple projects, which all compile with no problems. However, some of the projects are giving a lot of warnings in the editor about unresolved symbols, due to unresolved includes. Most are headers from other projects in the workspace, or third party libraries.

Googling suggests this is a problem with the indexer, but I haven't found any coherent explanations of how to fix it – I assume I need to add the paths to these libraries to the indexer's PATH, but I can't see any option to do that (I am using Juno).

Can anyone please explain to me how to configure CDT's indexer?

I am also getting unresolved include warnings for STL headers in two projects. Some STL headers are resolved but others aren't, and the list doesn't seem to be the same between the two projects (one finds things like vector and iostream, but not sstream or string, the other doesn't find iostream either).

Possibly relevant: these are C++ projects, but all the file extensions are .c. I changed the GCC C Compiler command to 'g++' to compile them, but I guess I also need to do something to the indexer settings to cope with it?

Best Answer

I had a similar problem where my project would build but showed unresolved includes in Eclipse Kepler.

In my case I had taken an existing ARM project and created a custom build configuration that used a different tool chain. The new build configuration had all the correct includes, so the project built correctly but the indexer wasn't picking it up.

I fixed it by setting the indexer to use the active build configuration. In Window->Preferences->C/C++->Indexer, under the section labeled "Build configuration for the indexer" I selected "Use active build configuration" and it cleared it up.

Related Topic