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

How to add libraries in Eclipse+ROS

asked 2013-01-24 08:05:15 -0500

shan333 gravatar image

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

ngrennan gravatar image

Hi all,

I am a newer for ROS. I want to compile ROS programs with Eclipse, that includes libraries like openCV, openNI.

Without ROS, I just need to add the library files and paths under linux gcc compiler, which can be set in eclipse project properties.

As I want to publish the computational results to control an arduino board via ROS publisher, I setup the eclipse program with ROS

but I dont know how to add external libraries and setup the compiler, here are what the program needs:





I cant find related tutorials, how can I compile the program successfully? Thanks a lot

edit retag flag offensive close merge delete


Here are the setup steps I followed:

shan333 gravatar image shan333  ( 2013-01-24 08:07:08 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-01-24 13:39:44 -0500

Since you followed the tutorial on IDEs you should have an autogenerated Eclipse project. So in this case you have to change the setting related to a build process in relevant CMakeLists.txt file, not in Eclipse project settings.

To link additional libraries add target_link_libraries directive to your CMakeLists.txt:

rosbuild_add_executable(my_node src/my_node.cpp)
target_link_libraries(my_node GL GLU glut opencv_core opencv_gpu)

In general, though, you may want to use find_package routine -- many of the libraries has relevant "find" modules for CMake. In case there is no such module you can always fall back to FindPkgConfig package which is a wrapper for system pkg-config utility. Please see here for more details.

edit flag offensive delete link more

answered 2013-01-24 13:07:10 -0500

Basically you have to follow this section, which you might have already seen, and specify the package dependencies in your manifest.xml file.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-01-24 08:05:15 -0500

Seen: 1,657 times

Last updated: Jan 24 '13