Eclipse Cdt: Unresolved Inclusion of Stl Header

Eclipse CDT: Unresolved inclusion of stl header

This allowed me to avoid Eclipse "Unresolved inclusion" error.

In my case I had to find the location of the C++ vector header on my computer (which is a Mac):

find /usr/local -name vector -print

I found the correct include location in folder "/usr/include/c++/4.2.1". Then I set my project eclipse settings like so:

Project->Properties->C/C++ General->Paths and Symbols->GNU C++->(Add)->"/usr/include/c++/4.2.1"

I'm not using C++ Builder, but my solution might address part of your trouble.

Eclipse CDT indexer - how to solve unresolved includes

Ok, so I've now fixed this issue.

  1. Unresolved includes from other projects in the workspace and third-party libraries was solved by adding the other projects as references. I guess the compiler knew where to look because I'd added the locations to the Includes list, but the indexer didn't (possibly due to eclipse only processing headers once?)

  2. Unresolved includes from STL I fixed by changing all my .c files that were actually C++ to .cpp. Just changing the compile command to 'g++' obviously wasn't enough to tell the indexer to treat the project as C++.

In the case of 1), I needed to clean/rebuild index of the referenced projects first to remove the unresolved include errors.

string could not resolved error in Eclipse for C++ (Eclipse can't resolve standard library)

The problem was that I needed to have both minGW and MSYS installed and added to PATH.

The problem is now fixed.

Eclipse CDT flags extern C in header file as syntax error

I got a reply to my bug.

The root cause apparently is that I originally generated the Eclipse project files from CMake using

cmake -G "Eclipse CDT4 - Unix Makefiles" ~/src/foobar

This functionality appears to be unmaintained and has caused lots of trouble in the past. Upon their recommendation, I tried installing cmake4eclipse (available on Eclipse Marketplace) and importing the project from scratch.

(If you reuse the same workspace and maintain the project name, even your build configurations are preserved—you may just need to update the paths.)

Moving to cmake4eclipse also eliminates a few other limitations of the previous setup and seems to fix another error with C files dropping out of the index over and over.



Related Topics



Leave a reply



Submit