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

Linking external libraries to ROS

asked 2012-02-25 06:58:36 -0500

Haikal Pribadi gravatar image

updated 2012-02-25 07:57:21 -0500

Hi all, I know this is something every c++ programmer has to know, but i'm java programmer and just started learning C++ and ROS. If I have compiling flags like the following to compile a C++ program (not in ROS), how do I integrate this to a ROS program and modify my manifest or CMakeFiles?

-l Festival -I/usr/include/festival -I/usr/lib/speech_tools/include -leststring -lestools -lestbase

EDIT: and are there any other settings that I have to do? like, setting dependencies for example (if that even makes sense)?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-02-25 07:10:27 -0500

ravenII gravatar image

updated 2012-02-25 07:12:30 -0500

Not sure if it is the best way I did this with the following in CMakeLists.txt

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/festival -I/usr/lib/speech_tools/include")

For linking target libraries

target_link_libraries(example rt
python2.6
other_libraries)
edit flag offensive delete link more

Comments

I see you put in the -I (includes) flags, but where do we put the -L (libraries) ?? I don't understand your second section of code. Could you please, explain? thanks @ravenll, really..

Haikal Pribadi gravatar image Haikal Pribadi  ( 2012-02-25 07:28:43 -0500 )edit
3
ravenII gravatar image ravenII  ( 2012-02-25 08:06:21 -0500 )edit

Uh, I did not see this link before. This keeps on happening to me. Where do they put all these intermediate tutorial links? or do you have to know the specific link to the secret page :) ? Thanks btw, ravenll..

Haikal Pribadi gravatar image Haikal Pribadi  ( 2012-02-25 08:18:59 -0500 )edit
3

answered 2015-02-24 02:01:02 -0500

Myzhar gravatar image

I add the same problem and I solved like this:

FIND_LIBRARY(EXT_LIBRARY extName library_full_path)

target_link_libraries(
  my_node
  ${catkin_LIBRARIES} ${EXT_LIBRARY }
)

In my case I needed to add the library for a DepthSense camera:

FIND_LIBRARY(DEPTHSENSE_LIBRARY DepthSense /opt/softkinetic/DepthSenseSDK/lib/)

target_link_libraries(
  depthsense_camera_node
  ${catkin_LIBRARIES} ${DEPTHSENSE_LIBRARY}
)
edit flag offensive delete link more

Comments

(a bit off topic) Not sure about its current status, but you might be interested in the softkinetic package.

gvdhoorn gravatar image gvdhoorn  ( 2015-02-24 02:23:29 -0500 )edit

Question Tools

Stats

Asked: 2012-02-25 06:58:36 -0500

Seen: 10,157 times

Last updated: Feb 24 '15