ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
11

Catkin and eclipse

asked 2013-01-11 01:42:21 -0500

Hunk gravatar image

updated 2014-01-28 17:14:48 -0500

ngrennan gravatar image

Hello,

i am using ROS Groovy on Ubuntu 12.04.

I want edit my packages in eclipse. On Fuerte i runed make eclipse-project and import this result as eclipse project.

At groovy i can include my catkin workspace as project. This is working.

But now i have a problems with my includes.

#include "ros/ros.h"

warning: Unresolved inclusion.

Or

ROS_INFO("text") error: Type 'std_msgs::String::ConstPtr' could not be resolved

and i couldnt see with crtl + mouse the functions.

What i do wrong ? what i must edit in eclipse that this is working?

thank you for your help

edit retag flag offensive close merge delete

7 Answers

Sort by ยป oldest newest most voted
15

answered 2013-01-22 13:15:13 -0500

updated 2013-01-30 09:02:20 -0500

Here is how I do this. Go to your workspace directory and run catkin_make with options to generate eclipse project files:

cd ~/catkin_ws
catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles"

The project files will be generated in the build/ folder. Now source the workspace setup and start eclipse from the terminal:

source ~/catkin_ws/devel/setup.bash
eclipse

This allows eclipse to get the correct environment to be able to build from within eclipse. Now import the project from the build/ folder. Eclipse provides a link named "Source directory" within the project so that you can edit the source code. Using this method, the indexer resolves all symbols correctly, and Eclipse is also able to build the workspace successfully.

edit flag offensive delete link more

Comments

thank you for the answer i can build my project in eclipse now. But in source directory in my files i have stille the problem that my functions could not be resolved. For example Function 'ROS_INFO_STREAM' could not be resolved. But i can build it. I dont understand why.

Hunk gravatar imageHunk ( 2013-01-23 01:54:04 -0500 )edit

Is it possible that i must change my library path manuel? that he can resolve this?

Hunk gravatar imageHunk ( 2013-01-23 01:55:58 -0500 )edit

This should work out of the box. Go to Project Properties -> C++ Include Paths, and make sure that all the required ROS include directories are present, like /opt/ros/groovy/include. Also try rebuilding the index if it's never been done before (Right click on project -> Index -> Rebuild).

kalakris gravatar imagekalakris ( 2013-01-23 06:39:16 -0500 )edit

If I execute /catkin_make -G"Eclipse CDT4 - Unix Makefiles"/ then the action is just normal catkin_make and no eclipse project is created. Any ideas why? Or how to find the eclipse project in build/? I can't see anything new.

r0nald gravatar imager0nald ( 2013-01-29 09:45:37 -0500 )edit

Do you see the .project and .cproject files in the build/ directory? These are what allow Eclipse to import the project, using File -> Import -> General -> Existing Projects into Workspace, and then select the build directory. It should then show you the auto-generated project which you can import.

kalakris gravatar imagekalakris ( 2013-01-29 10:17:07 -0500 )edit

No .project or .cproject anywhere.

r0nald gravatar imager0nald ( 2013-01-29 10:25:18 -0500 )edit
1

The problem was, that if all projects were compiled, then catkin_make did not invoke cmake and cmake did not get the command to make eclipse files. Eclipse files get generated if catkin_make clean was done previously or if I force cmake with the -force-cmake flag.

r0nald gravatar imager0nald ( 2013-01-29 20:45:28 -0500 )edit

Thanks for the information. I've updated the answer above to include --force-cmake.

kalakris gravatar imagekalakris ( 2013-01-30 09:03:37 -0500 )edit
11

answered 2013-05-29 22:50:57 -0500

fivef gravatar image

updated 2014-02-04 01:28:32 -0500

The accepted answer works for generating the project files out of source (The catkin way).

For an in source generation of the files use Quizzarex's answer: You can do this in any folder containing a CMakeLists.txt:

cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8

(I created a new answer because in comments formatting is not possible.)

edit flag offensive delete link more

Comments

Using this command worked better for me. Otherwise by doing cmake on the entire src folder there were some header files that Eclipse was not able to link to

Francisco Vina gravatar imageFrancisco Vina ( 2013-11-08 05:09:59 -0500 )edit

Creating a new answer is the correct thing to do regardless of formatting. Additional answers are too often put in comment chains.

Asomerville gravatar imageAsomerville ( 2014-06-17 13:07:51 -0500 )edit

This method will partly defeat the purpose of having catkin style packages (with source and build directories separate).

McMurdo gravatar imageMcMurdo ( 2014-06-20 03:19:45 -0500 )edit

To remove the whole garbage that gets generated do rm -r catkin catkin_generated/ CMakeCache.txt CMakeFiles/ cmake_install.cmake CTestTestfile.cmake devel/ gtest/ Makefile test_results/

BennyRe gravatar imageBennyRe ( 2014-09-24 01:12:25 -0500 )edit
4

answered 2013-01-12 00:24:04 -0500

Quizzarex gravatar image
  1. cd to your <groovy workspace="">/src
  2. run the following: cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 .

This should solve your problem

edit flag offensive delete link more

Comments

do you have an other idea? it is not working. but thank you for your help

Hunk gravatar imageHunk ( 2013-01-21 01:35:23 -0500 )edit
2

answered 2014-06-19 09:02:12 -0500

McMurdo gravatar image

updated 2014-07-16 09:33:36 -0500

Assuming that eclipse runs from a shell - that has all the env variables set up - the best thing to do is the following:

  1. Go to the "your catkin_workspace"/build directory.

  2. Either create a new directory for the package that you are about to compile or enter the already built package.

  3. So now the working directory is "your catkin_workspace"/build/"package_name":

From here run:

cmake ../../src/"package_name" -DCMAKE_INSTALL_PREFIX=../../install -DCATKIN_DEVEL_PREFIX=../../devel -G"Eclipse CDT4 - Unix Makefiles"

Viola!

This is better for two clear advantages:=

Firstly, you have different .project files for every project. This means that you can import them separately in eclipse. Secondly, this also means that when you build from within eclipse, the entire workspace is not built. Only the current project is built.

edit flag offensive delete link more
1

answered 2014-02-18 17:24:20 -0500

ncr7 gravatar image

Not sure if this will help anyone in particular but I've been trying to fix these link errors off and on for about a week now so I thought I'd share what I've found.

Ubuntu 12.04, ROS Hydro, Catkin, and Eclipse Indigo 3.7.2

So I've been trying to get my code into my Eclipse IDE. I ran the set up described in the IDE tutorial here, http://wiki.ros.org/IDEs

I then imported as the tutorial asked but got all sorts of link error issues... kept deleting the project and retrying the steps and checking to make sure that all components of C++ were installed for eclipse indigo. Tried manually adding libraries, but I was getting simple link errors like std::string.

Nothing in here really seemed to help with link errors. Until I noticed fivef and Quizzarex's answers here. I then went to workspace/src folder and ran the following,

cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8

Then in eclipse I imported the existing project from the workspace/src folder.

This worked much nicer as far as removing unnecessary clutter from your Project Explorer in Eclipse since it added only my catkin projects as they are and not my all my project build folders along with a separate linked [Source directories] directory. Although there probably is a solution to that using the prior method from the build folder.

To my surprise this method also removed my linking errors.


If your still having errors you may want to try using Eclipse Kepler.

I started using and noticed a new feature called "Re-resolve Unresolved Includes". This is actually when I noticed that my Workspace/src folder worked after running "Re-resolve Unresolved Includes" in Kepler... but I've since tried remaking the Eclipse Project and importing, as I mentioned above from the workspace/src directory, and haven't been able to reproduce the unresolved link errors.

Hope this helps, I guess its kind of a redundant post to fivef's and Quizzarex's answers but I was finally happy to see no link errors and thought I'd mention my solution.

edit flag offensive delete link more
0

answered 2016-07-22 14:41:25 -0500

gurusub90 gravatar image

updated 2016-07-25 14:37:54 -0500

This tutorial worked: http://cs460.coins-lab.org

You will also need to add the python path: adding python path

edit flag offensive delete link more
0

answered 2014-04-22 15:43:26 -0500

I have got Liclipse for Python. Is there a similar thing for Liclipse?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

8 followers

Stats

Asked: 2013-01-11 01:42:21 -0500

Seen: 31,736 times

Last updated: Jul 25 '16