Ask Your Question
1

how to include custom libraries

asked 2012-05-01 10:10:40 -0600

ecalisgan gravatar image

Hi everyone, I have a library(in C++) and I can compile and use it without ROS. It's a TCP/IP communication library. I want to listen those msgs and publish/use them in ROS. I know how to modify the cpp file to publish those msgs. But I don't know how to compile all together in ROS. So far, I found that I need to include target_link_libraries in CMakeList.txt file, but could not get it working. Let's say, my library sitting in home/ros_workspace/my_lib how should I modify the CMakeList.txt file?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-05-01 10:59:18 -0600

You can create your own library, like this:

ADD_LIBRARY( yourlibrary_name STATIC your_file_hpp_and_cpp ) TARGET_LINK_LIBRARIES( yourlibrary_name libraries_needed_by_your_library )

create node with your library rosbuild_add_executable(the_node_name src/file1.cpp ... src/filen.cpp ) target_link_libraries(the_node_name yourlibrary_name)

or simply add everything in rosbuild_add_executable(.....

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-05-01 10:10:40 -0600

Seen: 874 times

Last updated: May 01 '12