Catkin - Cannot Find Custom Library I Made In Another Package
Hi,
I created a custom library in my package pack_A
like so:
...
catkin_package(
INCLUDE_DIRS include
LIBRARIES mycustomlib
# CATKIN_DEPENDS
# DEPENDS
)
add_library(mycustomlib STATIC src/customsource.cpp)
target_link_libraries(mycustomlib ${other_libs})
...
And then in another package, I include pack_A
and try to explicitly link against mycustomlib
it instead of using {catkin_LIBRARIES}
like so:
...
find_package(catkin REQUIRED COMPONENTS pack_A)
add_library(liblinktest src/test.cpp)
target_link_libraries(liblinktest mycustomlib)
...
However I get the error:
error: cannot find -lmycustomlib
Can anyone help me out? I do not want to link against {catkin_LIBRARIES}
. Thanks for your time.
EDIT: This... actually does build. However, I've been developing within QtCreator, and for some reason I get the "cannot find ..." error in QtCreator, but when I build via catkin_make, it builds just fine and runs.
Does anyone know why there is such a discrepancy between QtCreator and catkin_make here?
Asked by trianta2 on 2014-01-13 15:54:36 UTC
Answers
If you do not use catkin you do have to make cmake/your linker aware of where your libmycustomlib.so is placed (as long as it is not in /usr/lib or something like that). You can do this using the link_directories() command
link_directories( /path/to/my/custom/lib )
Note that catkin usually puts the shared library files into
Asked by Wolf on 2014-01-14 01:38:37 UTC
Comments