Ask Your Question
0

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:

Path:

/usr/lib
/usr/local/lib

lib:

-OpenNI
-XnVNite_1_5_2
-glut
-GLEW
-opencv_core
-opencv_highgui
-opencv_imgproc
-opencv_gpu
-opencv_ml
-opencv_video
-opencv_features2d
-opencv_calib3d
-opencv_objdetect
-opencv_contrib
-opencv_legacy
-opencv_flann

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

edit retag flag offensive close merge delete

Comments

Here are the setup steps I followed: http://www.ros.org/wiki/IDEs

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

2 Answers

Sort by » oldest newest most voted
2

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
0

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

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

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

Seen: 1,439 times

Last updated: Jan 24 '13