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

Revision history [back]

Normally, I would say you should create a library. Just use the CMake macro

rosbuild_add_library(foo src/foo.cpp src/bar.cpp)

In this example, a library named libfoo.so is created from files foo.cpp and bar.cpp.

To use your library from other packages, you also need to update your manifest file. In our example, you need to add this:

<export>
  <cpp cflags="-I${prefix}/include" lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -lfoo"/>
</export>

To use your library in another package you can now just depend on your package.