Problems with system includes after cmake import [message #647353] |
Wed, 05 January 2011 18:29 |
Tim 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 :
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 |
Marc-André Laperle 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 #1013862 is a reply to message #649323] |
Sun, 24 February 2013 14:31 |
kesten Mising name 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03164 seconds