Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problems with system includes after cmake import
Problems with system includes after cmake import [message #647353] Wed, 05 January 2011 18:29 Go to next message
Tim is currently offline TimFriend
Messages: 2
Registered: January 2011
Junior Member
Hello,

I recently started to work on a collaborative project that is based on CMake. I can import this project into Eclipse using the CMake project generator (cmake -G ...), but then I get into trouble. Eclipse is not able to find the STL ; an "#include<vector>" line gets tagged as an 'Unresolved inclusion' and code related to the STL is not highlighted. (For libraries that are specific to the project and that are explicit in the CMakeLists.txt, everything works fine.)

Versions: Eclipse 3.5.2 'Galileo' with CDT 6.0, CMake 2.8.2 (all default in Ubuntu 10.10 'Maverick')

First, is this bug known for those versions ? I saw a report for an old version of CMake (2.6.x) but it was supposed to be fixed.

Second, I tried to apply a workaround I read here and there, that is, adding the system include paths (eg. /usr/include/c++/4.4/) as external dependencies in Project>Properties>C++ Include Path and Symbols. However, while Eclipse seemingly finds the libs as the 'Unresolved inclusion' labels disappear, it is still unable to highlight the code.

Here's a screenshot :

http://img811.imageshack.us/img811/6193/mybug.png

I cannot understand what I am doing wrong... Any help greatly appreciated !

Tim

[Updated on: Wed, 05 January 2011 18:34]

Report message to a moderator

Re: Problems with system includes after cmake import [message #647980 is a reply to message #647353] Mon, 10 January 2011 16:45 Go to previous messageGo to next message
Marc-André Laperle is currently offline Marc-André LaperleFriend
Messages: 256
Registered: July 2009
Senior Member
Tim wrote on Wed, 05 January 2011 13:29

Second, I tried to apply a workaround I read here and there, that is, adding the system include paths (eg. /usr/include/c++/4.4/) as external dependencies in Project>Properties>C++ Include Path and Symbols. However, while Eclipse seemingly finds the libs as the 'Unresolved inclusion' labels disappear, it is still unable to highlight the code.



You shouldn't need to do that. I'm thinking maybe the CMake generator doesn't set the toolchain so scanner discover can't detect the built-in includes and symbols. Without the symbols, parsing will probably not work as well! In your project properties, C/C++ Build, Tool chain editor, is the Linux GCC toolchain selected? If not, try setting it and build again. I'm not sure the built-in includes and symbols will get picked up though, scanner discovery is acting weird sometimes.

I've never tried the CMake generator for CDT, here's what I usually do:

mkdir build
cd build
cmake -G "Unix Makefiles" ../

Then in Eclipse:
1. File, new, C or C++ project
2. Makefile project, empty.

Location: browse for the location of your project (the folder that contains build).
Make sure you select Linux GCC on the right!

3. Go to your project properties, C/C++ Build. Change the build directory to...the build directory. Add any external includes and symbols your project needs in C/C++ General, Paths and Symbols.

4. After pressing Ok, look in the Error log (Window, Show view, other... General, Error log). You should see a line in there ''indexed.......unresolved names (x%). The percentage of unresolved names should be low!
Re: Problems with system includes after cmake import [message #649323 is a reply to message #647353] Tue, 18 January 2011 18:21 Go to previous messageGo to next message
Tim is currently offline TimFriend
Messages: 2
Registered: January 2011
Junior Member
Damn this forum is bugged ! Second time I lose a post...

I managed to make the generator work for a small project, (by simply removing CMakeCache.txt), but for a bigger one no way, and apart from the missing paths and symbols I did not see any obvious differences in project properties.

Plus even with the working project I cannot compile into Eclipse.

In the end... Your approach works great. Smile Thanks a lot.

Tim

[Updated on: Tue, 18 January 2011 18:23]

Report message to a moderator

Re: Problems with system includes after cmake import [message #1013862 is a reply to message #649323] Sun, 24 February 2013 14:31 Go to previous messageGo to next message
kesten Mising name is currently offline kesten Mising nameFriend
Messages: 6
Registered: December 2011
Junior Member
It seems to be a know problem that the CDT4 generator for Eclipse from a cmake project is pretty frail. IRK - can't post with links yet...

Option 2 in the CDT4 eclipse tutorial is the most likely method to work. If option one works... you got lucky.

You can see some discussion here
IRK again.

in particular, unless you are running gcc or intel compiler, you have no hope. If you are, the "includes discovery" relies on parsing the output of running the gcc command on a dummy file. That's not a strategy likely to show up in Design Patterns any time soon. More likely, in resign patterns.

I'll add the links once i have over 5 posts.

[Updated on: Sun, 24 February 2013 14:32]

Report message to a moderator

Re: Problems with system includes after cmake import [message #1014290 is a reply to message #1013862] Mon, 25 February 2013 14:25 Go to previous message
kesten Mising name is currently offline kesten Mising nameFriend
Messages: 6
Registered: December 2011
Junior Member
Some of the issues have been resolved in cmake 10.8.2
Previous Topic:Meaning of Default and Detail in Variables View
Next Topic:Wrong editor opens on some cpp and hpp files
Goto Forum:
  


Current Time: Thu Apr 18 09:58:05 GMT 2024

Powered by FUDForum. Page generated in 0.03164 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top