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

link library from devel/lib

asked 2017-11-20 07:05:26 -0600

Jan Fox gravatar image

Hi,

I'm pretty sure that this question has been answered already, but for some reason I'm not able to find the right solution, and currently I am confused by the results I read. So I hope you can point me in the right direction.

I have created a library in one package, using the install() command of the cmakelists. This Library does appear in my workspaces devel/lib, as "libMYLIB.so". I want to use this library within another package, but I'm not exactly sure how. I tried it with just using

target_link_libraries(${PROJECT_NAME}_node

${catkin_LIBRARIES}

MYLIB )

But i get the error

/usr/bin/ld: cannot find -lMYLIB collect2: error: ld returned 1 exit status

I tried using

link_directories( ${CATKIN_PACKAGE_LIB_DESTINATION} )

, since this directory was used to install the library, but to no effect. What should I do, or where can I find the definite answer?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-11-20 08:26:39 -0600

lucasw gravatar image

updated 2017-11-20 08:33:58 -0600

http://docs.ros.org/kinetic/api/catki...

In the library building package be sure to have your library listed as something other projects can use:

catkin_package(
               ...
               LIBRARIES MYLIB)

Put the name of the package you built the library into a <build_depend> in package.xml and put it into in the list of packages in find_package() in your CMakeLists.txt. The actual name of the library doesn't matter (just the name of the package that built it), it will get included in ${catkin_LIBRARIES}.

edit flag offensive delete link more

Comments

That was easier than expected. Thanks. I was sure I tried this, but maybe I made a spelling error.

Jan Fox gravatar image Jan Fox  ( 2017-11-20 08:38:13 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-11-20 07:05:26 -0600

Seen: 862 times

Last updated: Nov 20 '17