0
$\begingroup$

Rosanswers logo

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.


Originally posted by AlphaSierra on ROS Answers with karma: 124 on 2013-08-11

Post score: 3


Original comments

Comment by lifelonglearner on 2013-08-12:
I also have similar problem when I am trying to use serial package of ROS

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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

Originally posted by Martin Günther with karma: 11816 on 2013-08-12

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by AlphaSierra on 2013-08-12:
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.

Comment by Martin Günther on 2013-08-12:
Hmm. In that case, I don't know how to solve this. It's still strange that you had to import the environment variables.

Comment by AlphaSierra on 2013-08-12:
Do I need to call eclipse with any arguments to make it take the shell's environment variables?

Comment by Martin Günther on 2013-08-12:
No, at least not up to Eclipse Juno.

Comment by AlphaSierra on 2013-08-12:
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.

Comment by Martin Günther on 2013-08-13:
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?

Comment by AlphaSierra on 2013-08-13:
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.

Comment by AlphaSierra on 2013-08-13:
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?

$\endgroup$
0
$\begingroup$

Rosanswers logo

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...


Originally posted by Jeremy Zoss with karma: 4976 on 2013-08-15

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by AlphaSierra on 2013-08-15:
I see. This is something I think should go in the wiki setup instructions for eclipse.

Comment by Martin Günther on 2013-08-18:
+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.

Comment by AlphaSierra on 2013-08-19:
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!

Comment by Martin Günther on 2013-08-20:
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.

Comment by AlphaSierra on 2013-08-20:
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?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.