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:
+ 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.
-Person