[ros-users] linking shared library
Brian Gerkey
gerkey at willowgarage.com
Tue Jun 1 19:48:22 UTC 2010
hi Dan,
We rely on each package to export appropriate compile and link flags,
in a manner similar to pkg-config. So in your case, package B's
manifest.xml should contain lines similar to:
<export>
<cpp cflags="-I${prefix}/include" lflags="-Wl,-rpath,${prefix}/lib
-L${prefix}/lib -lB"/>
</export>
Package A, by virtue of depending on B, will have those flags added
during the build.
brian.
On Tue, Jun 1, 2010 at 12:40 PM, Dan Lazewatsky
<lazewatskyd at cse.wustl.edu> wrote:
> 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
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
More information about the ros-users
mailing list