ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

How to use a static library?

asked 2013-01-12 07:34:06 -0500

Dumpsomer gravatar image

Specifically, I am trying use the RoBoIO library that comes with the RoBoard. The library consists of two folders: Include, which has all the .h files, and Lib, which has a .a file.

Without using ROS, I can use the functions provided by library by linking it through this MAKEFILE:

test.exe : test.o
    gcc -o test.exe test.o -L../Lib -lRBIO -lstdc++
test.o : test.cpp
    gcc -c test.cpp -I../Include

.PHONY : clean
clean :
    -rm test.o test.exe

What do I need to do if I want the library to linked when I use rosmake to compile my program?? I tried to simply include the .h file, but that didn't work. The library functions became undefined.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-01-12 08:37:32 -0500

cagatay gravatar image

you can add compile flags in your CMakeLists file. check out here for details Cmakelists Examples

edit flag offensive delete link more
0

answered 2013-08-16 01:21:42 -0500

Mfumbesi gravatar image

Try using this ROS CMakeLists macro: target_link_libraries(test RBIO)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-01-12 07:34:06 -0500

Seen: 2,924 times

Last updated: Aug 16 '13