Including C++ headers in another package

 To import and include header files from a different package than the one where you're working on, it is just required to do these two things:

  1.  Open the CMakeLists.txt (of the working package (destination), not the one where the header is defined), and add, on the find_package command, the name of the package where the header is defined:
     
    ...
    find_package(catkin REQUIRED COMPONENTS
    roscpp
    my_roscpp_library
    )
    ...
     
  2.  Open the package.xml (of the working package (destination), not the one where the header is defined) and add a new line with a <depend> tag:
     
    <depend>my_roscpp_library</depend>
     
     
    After these two steps, you should be able to compile your project. If you're using a catkin workspace, just run the catkin_make command.
    For more information, read this.

Comments

Popular posts from this blog

Remote Control of UR10e via MoveIt (ROS)

Real-time UR10e following a tracked object

UR10e control architecture