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

How to link code with catkin?

asked 2013-11-01 07:39:54 -0500

oars gravatar image

I'm having trouble linking code with catkin have the following file structure:

mypackage/
|src/
    | ros_node.cpp
|lib/
    | library.c
|include/
    | library.h

ros_node.cpp includes library.h and my CMakelist has the following for building:

add_library(library lib/library.c)
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(ros_node src/ros_node.cpp)    
add_dependencies(ros_node ros_node_generate_messages_cpp)
target_link_libraries(ros_node ${catkin_LIBRARIES} library)

This fails when linking the library to the ROS node. Anyone able to point me in the right direction for properly linking with ROS?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-11-01 09:35:23 -0500

oars gravatar image

Solved it. I was missing link_directories(lib).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-11-01 07:39:54 -0500

Seen: 77 times

Last updated: Nov 01 '13