Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » External library includes not resolved (sometimes) in project generated from cmake(CDT indexer arbitrarily stops resolving includes)
icon5.gif  External library includes not resolved (sometimes) in project generated from cmake [message #1033418] Thu, 04 April 2013 04:03 Go to next message
Enis Bayramoglu is currently offline Enis Bayramoglu
Messages: 5
Registered: July 2009
Junior Member
Hi,

I'm using Eclipse 4.2.2 and CDT 8.1.2.201302132326

I'm having a little issue with CDT; I have a moderately complicated cmake project that I would like to work on using CDT. I use the following command to generate an Eclipse project:

cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_BUILD_TYPE=RelWithDebInfo ../src/


Then in Eclipse I import the project as usual. Initially I had some issues in getting the C++11 standard library symbols to be resolved, but I seem to have solved it now.

In summary, (In case it's relevant)


  1. I've added
    add_definitions(-D__GXX_EXPERIMENTAL_CXX0X__)
    to the CMakeLists.txt before using the cmake command.
  2. In Eclipse I've gone to the project properties and under "C/C++ General"->"Preprocessor Include Paths, Macros etc."->"Providers(Tab)" and I've "Enabled language settings providers for this project".
  3. Then I've chosen "CDT GCC Built-in Compiler Settings"
  4. Then I've added
    -std=c++0x
    into the "Command to get compiler specs" field.
  5. I've pressed Apply, closed the dialog and rebuilt the index.


At this point, my Eclipse CDT setup works perfectly. Everything is indexed, CODAN is reporting no spurious errors and I have a dream development environment.

Sadly, that's not the end of the story. Changing nothing, when I restart Eclipse, CDT stops resolving all the include files except for those in the standard library. It's as if no external include folder is provided. Strangely enough, those include folders are still visible under the "includes" node in the project explorer. However, they're now gone from the "Properties"->"C/C++ General->Preprocessor Include Paths, Macros etc."->"Entries->GNU C++"->"CDT GCC Built-in Compiler Settings" list. Only the standard include paths are shown there.

I've tried many things like disabling language settings providers, re-enabling it and rebuilding the index, re-resolving includes and numerous other things to get CDT to see those folders again, but the only thing that seems to work is to remove the project from Eclipse, wipe all the files generated by cmake, re-create the project from scratch and import it back. Obviously, that works until the next restart of Eclipse.

Do I need to live with recreating the project and re-applying the steps I've described above every time I restart Eclipse? or is there a way to get CDT to resolve includes in folders that it already sees in the "Project Explorer" view?

Thanks
Re: External library includes not resolved (sometimes) in project generated from cmake [message #1033446 is a reply to message #1033418] Thu, 04 April 2013 04:29 Go to previous messageGo to next message
Enis Bayramoglu is currently offline Enis Bayramoglu
Messages: 5
Registered: July 2009
Junior Member
OK, now I've a very dirty solution to my own problem:

Just like in step 4 above where I add "-std=c++0x" into the "Command to get compiler specs" field, I also add "-I{include folder}" for each external library location manually. That solves the problem but it is very dirty, and I would like to know why the problem occurs in the first place. It's clearly a bug since the problem manifests itself after an Eclipse restart. It's also curious that the include folders are visible in the project explorer but the include files inside them are not resolved.
Re: External library includes not resolved (sometimes) in project generated from cmake [message #1033962 is a reply to message #1033446] Thu, 04 April 2013 17:32 Go to previous message
Andrew Gvozdev is currently offline Andrew Gvozdev
Messages: 253
Registered: July 2009
Senior Member
Can you open a bug at https://bugs.eclipse.org against CDT, describe the problem and attach .project and .cproject files? Please, also mention which version of CDT you are running.

Thanks,
Andrew
Previous Topic:Bring Console to top when build started
Next Topic:Eclipse magic/opaque folder semantics
Goto Forum:
  


Current Time: Wed Apr 23 20:44:26 EDT 2014

Powered by FUDForum. Page generated in 0.01940 seconds