ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Standard system include paths missing in Eclipse from catkin_make

asked 2013-04-23 07:41:57 -0500

dsolomon gravatar image

updated 2014-01-28 17:16:19 -0500

ngrennan gravatar image

When I use catkin_make to create the Eclipse project files, it does not include some standard system dependencies in the Include Paths, namely:

  • /usr/include/c++/4.6
  • /usr/include/c++/4.6/x86_64-linux-gnu
  • /usr/include/c++/4.6/backward

I run

 $ catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles"

and import the project in Eclipse from the build directory. (see (catkin and eclipse))
When I import the project in Eclipse, it is missing the above includes, which causes it to complain about - namely, among other things - "Unresolved include of #include < string >"

This in turn propagates errors of "Type std::string could not be resolved"

The package builds just fine, which means the compiler can resolve all required includes, this is just a problem in using Eclipse effectively.

QUESTION: Is there a way to have catkin build the Eclipse project files with those includes?

(SPECS: Groovy on Ubuntu 12.04)

edit retag flag offensive close merge delete



I think this is more of a question about CMake. If you make a simple CMake project and give it the -G"Eclipse.... argument are the include paths set correctly? If they are then we might need to look into why catkin is different, but otherwise I think this is a general CMake question.

William gravatar image William  ( 2013-04-23 07:51:50 -0500 )edit

William, that set me on the right path. To work around my current problem, I added following two lines in my CMakeLists.txt: SET(STANDARD_INCLUDE_DIRS "/usr/lib/gcc/x86_64-linux-gnu/4.6/include; /usr/(...etc) ) include_directories(include ${STANDARD_INCLUDE_DIRS} ) There must be a more-correct way.

dsolomon gravatar image dsolomon  ( 2013-04-23 18:45:44 -0500 )edit

So while this is an issue with CMake, it still feels like the auto-generated CMakeLists.txt files should have rules that account for this. The package has no problem building, so the directories are obviously included and linked properly, they just don't export to the eclipse project files.

dsolomon gravatar image dsolomon  ( 2013-04-23 18:53:03 -0500 )edit

FWIW I ran into the exact same issue (on 12.04 + groovy + catkin) before. It seems it is somehow related to catkin. Other cmake eclipse projects (in my case from rosbuild packages) work just fine without any special handling of the above include paths.

demmeln gravatar image demmeln  ( 2013-04-24 03:51:38 -0500 )edit

I'm not sure why, but as of yesterday this issue was resolved for me. All expected include paths were present in the project settings. Anyone have any insights?

dsolomon gravatar image dsolomon  ( 2013-08-21 05:51:48 -0500 )edit

5 Answers

Sort by » oldest newest most voted

answered 2013-04-24 07:17:26 -0500

William gravatar image

It looks like the CMake Eclipse generator does not include these paths, because they are implicitly included by the compiler. It looks like you can either add them to you include path manually within CMake or you can globally configure eclipse to include them.

From that post, it seems like the suggestion is to add it to eclipse globally, as they pointed out it is redundant (and not portable) to put these paths in CMake manually and is not necessary as the builds succeed. Rather I think the better solution is to globally configure eclipse to add those by default for autocompletion and syntax checking purposes.

edit flag offensive delete link more


I was using that before I modified CMakeLists, but each time Eclipse project files are regenerated (ie new dependancy added) all includes (including manually added external paths) are overwritten. Is there a command in CMake to make implicit includes explicit (ideally just for make eclipse project)?

dsolomon gravatar image dsolomon  ( 2013-04-24 13:27:10 -0500 )edit

I don't know of one. I think the suggestion is to add the standard include paths above the project settings level, i.e. so that it applies to all projects. I have to do this in my editor even for non-catkin projects, but I don't know how or if you can do this in eclipse.

William gravatar image William  ( 2013-04-24 13:30:36 -0500 )edit

answered 2013-07-30 04:34:36 -0500

stomic gravatar image

I had the same problem. I am using eclipse CDT Kepler. To solve it, go to project properties, find 'preprocessor Include Paths', then under the tab 'providers' you will find 'CDT_GCC Built-in Compiler Settings'. Check it and that's it. It's better than to add all include dirs manually.

edit flag offensive delete link more


Thanks! I use to add these paths by hand with "Add Contributed..."

Boris gravatar image Boris  ( 2013-07-30 21:14:19 -0500 )edit

answered 2013-09-22 02:19:56 -0500

updated 2013-09-23 04:02:26 -0500

I just ran into the same problem (no idea why this didn't happen before). Turns out that eclipse can't parse localized gcc messages, so the auto-discovery of standard include paths from the gcc output fails. Solution: LC_ALL=C eclipse Or, if you like that better: "Window -> Preferences -> C/C++ -> Build -> Environment", add two new environment variables "LANG" and "LC_ALL" and set them both to "en_US" or "C". Also see [this eclipse forum post]( (Who actually wants localized error messages from gcc? The German translation usually makes them even more cryptic, IMO...)

Update: After trying to reproduce this on a fresh work space, it turned out that I was wrong, LC_ALL has nothing to do with it. @stomic's answer is correct. I had to follow these steps (Eclipse Juno, ROS Groovy):

  1. right-click Project -> C/C++ General -> Code Analysis -> Preprocessor Includes -> Providers -> "Enable language settings providers for this project", then enable only "CDT GCC Built-in Compiler Settings"
  2. remove project (but keep contents on disk), then import project again
  3. you may have to right-click Project -> Index -> Rebuild
edit flag offensive delete link more

answered 2013-08-30 06:34:08 -0500

bluebird11 gravatar image

Here are some other problems I had and the solutions (rather workarounds) I've found:

  • Indexing in Eclipse fails, because Eclipse runs out of memory. Run eclipse with this option to increase max memory (source)

./eclipse -vmargs -Xmx2048m

  • I had indexing stability problems with both Juno and Kepler, so I reverted back to Indigo. It's seems to be indexing properly and stably, but the 'Preprocessor Include Paths' solution from stomic isn't available, so the headers need to added manually.
  • Here are my headers:






  • In /usr/include/eigen3/Eigen: all headers are without a .h extension, so Eclipse can't find them... Create symbolic link for each header: ln -s SVD SVD.h
  • Create symbolic link of Eigen in /usr/include: ln -s eigen3/Eigen Eigen (Eclipse has problems finding subdirectories...).
  • Same problem with pcl in pcl-1.6, so copy the content of /opt/ros/groovy/include/pcl-1.6/pcl to /opt/ros/groovy/include/pcl

If anyone knows better concerning some of these issues, please let me know. I've spent quite a lot of time to figure this out, so I hope it will be of help to others.

edit flag offensive delete link more


This answer solves a problem which is not solved by @stomic's answer. Eigen ans pcl have real problems while including in eclipse

mach gravatar image mach  ( 2016-08-01 18:51:43 -0500 )edit

answered 2013-04-24 21:35:22 -0500

anonymous user


I encountered the same problem and do not use the autogenerated project files. I run catkin_make to create the devel and build directory. Than I create an eclipse project using "Makefile project with existing code" (import the src dir). It needs a little fine tuning:

  • set the build directory in "C/C++ build" (will call make inside the create build instead of the src dir)
  • link the build directory in "C/C++ General - Paths and Symbols" to find the binaries

Eclipse has all the paths. Compiling and debugging works. Running binaries as well. So far no problems.

edit flag offensive delete link more

Question Tools



Asked: 2013-04-23 07:41:57 -0500

Seen: 11,883 times

Last updated: Sep 23 '13