[ros-users] linking shared library

Dan Lazewatsky lazewatskyd at cse.wustl.edu
Tue Jun 1 19:40:24 UTC 2010


Hi everyone,
I have a stack with a few packages, an one of the packages (let's say  
package A) needs to link a shared library from one of the other  
packages (package B), but I'm having trouble to get rosmake/cmake look  
in the right place. If I try to call any function in the so from B, I  
get "undefined reference to `SomeFunctionFromB()"

Here's the CMakeLists.txt from A:

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

rosbuild_init()

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

rosbuild_add_executable(${PROJECT_NAME} src/main.cc)
target_link_libraries(${PROJECT_NAME} B)

Any suggestions?

Thanks,
-Dan



More information about the ros-users mailing list