-
Notifications
You must be signed in to change notification settings - Fork 38
Catkin Eclipse
This guide explains how to set up an Eclipse project for a single catkin package when using the catkin command line tools.
We first need to tweak Eclipse to recognize includes from the compilation commands and to properly recognize C++11 traits (if we are using C++11): Go to Window->Preferences->C/C++->Build->Settings and select the "Discovery" tab. In "CDT GCC Buid Output Parser [ Shared ]" prepend ".*" to the regular expressions, e.g.:
(.*gcc)|(.*[gc]\+\+)|(.*clang)
This will help Eclipse CDT recognize compiler calls that also contain the path to the compiler. Then, in "CDT GCC Built-in Compiler Settings [ Shared ]" add the "-std=c++11" flag to obtain e.g.:
${COMMAND} -E -P -v -dD -std=c++11 "${INPUTS}"
Reminder: This guide is tailored to the catkin command line tools, which keep separate build directories for each package.
File->New->Project... , C/C++->"Makefile Project with Existing Code" , "Next", enter a name and browse to your package location in "Existing Code Location", hit Finish
Right-click the project and go to Properties->"C/C++ Build". In the "Builder Settings" Tab, change the "Build directory" to the folder corresponding to your package in the catkin build folder (typically ~/catkin_ws/build/<project name>). You may also want to check "Enable parallel build" in the "Behavior" tab. "Apply".
In "C/C++ Build"->Environment add a variable VERBOSE with value 1, add to all configurations. "Apply"
Go to "C/C++ General"->"Preprocessor Includes", "Providers" tab. Check "CDT GCC Build Output Parser" and "CDT GCC Built-in Compiler Settings" and verify that you "Use global provider shared between projects" in both. "Apply" and "OK".
Hitting Ctrl+B should now build your project. You should see a folder "Includes" appear in your project. If there is nothing to build, modify and save a file and re-build. Erroneous error messages should from now on disappear the more you build and the more project files you open.