[ros-users] Problem linking to libraries from other Ros pack…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ ros-problem.tar (application/x-tar)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: ros-users
Subject: [ros-users] Problem linking to libraries from other Ros packages
Hello,

I am having trouble figuring out how to include libraries from other packages I
have written. I have attached a minimal example of my problem.

I have package A that contains foo.cpp and foo.h, and I have package B that
contains bar.cpp from which it tries to call a function in foo.cpp. I have
placed foo.h in "include/A/foo.h", and all cpp files are in their respective
"src" folders. I have configured the manifests of package A and B as follows:


---- A ----
+ <export>
+ <cpp cflags="-I${prefix}/include" lflags="-Wl,-rpath,${prefix}/lib
-L${prefix}/lib -lA"/>·
+ </export>
---- B ----
+ <depend package="A"/>

...and I have configured the CMakeLists.txt of packages A and B as follows:
---- A ----
+ rosbuild_add_library(foo src/foo.cpp)
---- B ----
+ rosbuild_add_executable(bar src/bar.cpp)
+ target_link_libraries(bar A)

It seems that I have no trouble including "A/foo.h" from bar.cpp, but I cannot
use any of the functions. When I try to compile package B, I get the error
"/usr/bin/ld: cannot find -lA" What am I doing wrong?

I would very much appreciate it if someone could point me in the right
direction, or email a new attachment with the fixed source. I've followed the
advice in the following links, but have had no luck getting this example to
work.
http://ros-users.122217.n3.nabble.com/linking-shared-library-td862667.html
http://www.ros.org/wiki/Manifest
http://www.ros.org/wiki/rosbuild/CMakeLists

-Person