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

link library from devel/lib

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

Jan Fox gravatar image


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 "". I want to use this library within another package, but I'm not exactly sure how. I tried it with just using




But i get the error

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

I tried using


, 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

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

lucasw gravatar image

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

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

               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


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



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

Seen: 774 times

Last updated: Nov 20 '17