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

Eclipse not resolving anything

asked 2013-08-11 23:52:12 -0600

AlphaSierra gravatar image

updated 2014-01-28 17:17:38 -0600

ngrennan gravatar image

I recently got eclipse setup and loaded the catkin project into it. However it seems incapable of resolving anything in the project. Not even standard math functions like atan or sqrt. I am running eclipse from the terminal.

I tried making a simple C program to make sure that nothing was wrong with the compiler in general, and it worked fine.

I've tried rebuilding the project with these options:

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

I also tried rebuilding the index, as well as adding in the usual default C paths as outlined in this thread: http://answers.ros.org/question/68074/eclipse-and-catkin-problems-symbol-could-not-be-resolved/

Beyond this I don't know what else could be wrong. I had eclipse run a search and apparently all of the includes are unresolved in the project. Even cmath isn't being found.

The include paths that exist in the project are:

#ROS_BUID_SHARED_LIBS=1
#ROS_PACKAGE_NAME="rov1_control"
/usr/src/gtest/include
/usr/src/gtest
/home/rosbox/catkin_ws/rov1_control/include
/opt/ros/groovy/include
/usr/include
/usr/include
/home/rosbox/catkin_ws/devel/include
/home/rosbox/catkin_ws/src/beginner_tutorials/include
/home/rosbox/catkin_ws/src/learning_tf/include

I did notice that when I first imported the project that it didn't bring in any other environment variables. I had to manually add ROS_ROOT, ROS_PACKAGE_PATH, PYTHONPATH, and PATH. I have my .bashrc set to source setup.sh, and noticed this continued even after I manually resourced the session.

The environment variables that I see under the C/C++ Make Project menu are:

CMAKE_NO_VERBOSE
VERBOSE

I'm not sure what else to try to solve this. Has anyone encountered this before? Thanks!

EDIT: Just another observation to add. When I initially load eclipse it seems to be happy with the C++ math functions like atan2, but as soon as I go to edit anything it seems to lose those references.

EDIT 2: Solution found!

The default includes were insufficient, so I started manually adding in includes from a working C++ hello world project until it stopped giving me errors. My includes list is as follows:

/home/rosbox/catkin_ws/devel/include
/opt/ros/groovy/include
/usr/include
/usr/include/c++/4.6
/usr/include/c++/4.6/backward
/usr/include/c++/4.6/i686-linux-gnu/
/usr/include/c++/4.6/i686-linux-gnu/bits/c++config.h
/usr/include/i386-linux-gnu/
/usr/lib/gcc/i686-linux-gnu/4.6/include
/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed
/usr/local/include

Followed by the various project directories.

edit retag flag offensive close merge delete

Comments

I also have similar problem when I am trying to use serial package of ROS

lifelonglearner gravatar image lifelonglearner  ( 2013-08-12 00:13:51 -0600 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2013-08-12 04:43:47 -0600

updated 2013-09-23 04:03:40 -0600

The problem is most likely that when you run eclipse from the menu, it is started in a non-interactive shell (which probably isn't even bash, but dash or something). That's why your .bashrc isn't sourced.

Try running the eclipse binary (and not some wrapper script) from the command line and see whether the errors disappear. If yes, you can write your own wrapper script. Mine looks like this:

#!/bin/zsh -i
export ECLIPSE_HOME="/home/martin/opt/eclipse"
export GDK_NATIVE_WINDOWS=true
$ECLIPSE_HOME/eclipse -vmargs -Xmx1500m "$@"

If you're using bash, replace the zsh by bash. The -i parameter starts an "interactive" shell, which basically only means that all of your .bashrc will be sourced, and thereby also the ROS setup.bash.

If you want to be able to start eclipse from the menu, you have to modify the eclipse.desktop file so that it starts your wrapper script.


Update: As requested, here are my include dirs (for a catkin workspace that has only one project, katana_moveit_ikfast_plugin):

/usr/src/gtest/include
/usr/src/gtest
/usr/include/eigen
/opt/ros/groovy/include
/usr/include
/home/martin/ros-groovy-ws/src/katana_moveit_ikfast_plugin/include
edit flag offensive delete link more

Comments

I have been running the binary from the terminal, not from any menus. I extracted it so it resides in ~/eclipse, and I then made a symlink from there to /opt/bin. I updated the question to include that I've been running from terminal.

AlphaSierra gravatar image AlphaSierra  ( 2013-08-12 09:21:05 -0600 )edit

Hmm. In that case, I don't know how to solve this. It's still strange that you had to import the environment variables.

Martin Günther gravatar image Martin Günther  ( 2013-08-12 09:28:38 -0600 )edit

Do I need to call eclipse with any arguments to make it take the shell's environment variables?

AlphaSierra gravatar image AlphaSierra  ( 2013-08-12 09:37:37 -0600 )edit

No, at least not up to Eclipse Juno.

Martin Günther gravatar image Martin Günther  ( 2013-08-12 09:55:35 -0600 )edit

I'm currently using Kepler. Perhaps there is some include that is missing from my include paths. Could you give me a list of all the include paths you have? I also noticed that the Libraries list under the C/C++ project paths are empty.

AlphaSierra gravatar image AlphaSierra  ( 2013-08-12 11:16:57 -0600 )edit

I've added my include dirs to my answer. Just to make sure that it's an Eclipse problem and not a problem with your catkin workspace setup: can you run catkin_make successfully?

Martin Günther gravatar image Martin Günther  ( 2013-08-13 03:56:43 -0600 )edit

I can. I tried searching for unresolved includes, and it turns out that the headers which are failing are themselves failing to resolve bits/c++config.h. What could cause this, keeping in mind that I successfully ran a hello world program in a separate project.

AlphaSierra gravatar image AlphaSierra  ( 2013-08-13 09:06:18 -0600 )edit

Looks like eclipse isn't resolving in /bits under /usr/include/c++/4.6. I manually added it, but it's still looking for bits/c++config.h under that directory. Similar issues for 4.6/backward, 4.6/bits, and 4.6/ext. gtest/internal is missing stuff under /sys. Any ideas on what's happening here?

AlphaSierra gravatar image AlphaSierra  ( 2013-08-13 18:27:17 -0600 )edit
2

answered 2013-08-15 04:42:04 -0600

See here for a similar discussion. It seems unclear whether this is "by design", or related to cmake's processing of default include directories. But there may be some other suggestions there that can help you out...

edit flag offensive delete link more

Comments

I see. This is something I think should go in the wiki setup instructions for eclipse.

AlphaSierra gravatar image AlphaSierra  ( 2013-08-15 06:23:51 -0600 )edit

+1, I think this is the right answer. Looks like @stomic's answer in that post is the most elegant solution (I can't test it, since I don't have Kepler). It would be even better if you could configure Eclipse to do that globally instead of per project.

Martin Günther gravatar image Martin Günther  ( 2013-08-18 23:16:57 -0600 )edit

I think that having it automatically play with includes globally could pose issues for people who for whatever reason may be stuck using a specific version for a project. At least we now have a solution listed here. I'll mark this as solved. Thank you all for your help!

AlphaSierra gravatar image AlphaSierra  ( 2013-08-19 01:40:43 -0600 )edit

You're right. On the other hand, if you set these paths per project, the settings will be deleted again when the eclipse project is re-generated. Choose whatever fits you best.

Martin Günther gravatar image Martin Günther  ( 2013-08-20 02:51:39 -0600 )edit

Ah, good point. I'll try and figure out how to get that setup. I don't need to use old versions, and existing projects shouldn't have issues. If eclipse doesn't support global includes could I modify the generation script to include those paths?

AlphaSierra gravatar image AlphaSierra  ( 2013-08-20 11:08:52 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2013-08-11 23:52:12 -0600

Seen: 3,664 times

Last updated: Sep 23 '13