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 close merge delete ## 1 Answer Sort by » oldest newest most voted 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}.

more

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

( 2017-11-20 08:38:13 -0500 )edit