Rosanswers logo


I am new to colcon and ros in general, so please forgive my newby question. I completed the all the beginner ROS2 tutorials and all went well.

Now I am trying to compile some third party code into a library (feetech_driver) to use in another ROS package (ft_joint). I have been able to compile the library and the output files are copied to


All the header files are in the ros_ws/install/feetech_driver/include/feetech_driver directory

My other ROS package (ft_joint) that is trying to use this library package cannot find the required header file, I am including it like so,

#include "feetech_driver/SCSCL.h"

As part of my ft_joint package I also include files from the tutorial_interfaces tutorial and I can include those without error, like so,

#include "tutorial_interfaces/msg/num.hpp" 

My CMakeList.txt has a find_package for both packages, like so

find_package(tutorial_interfaces REQUIRED)
find_package(feetech_driver REQUIRED)

The error that I get when I run

colcon build --packages-select ft_joint


/home/stewart/ros/dev_ws/src/ft_joint/src/joint_node.cpp:6:10: fatal error: feetech_driver/SCSCL.h: No such file or directory
    6 | #include "feetech_driver/SCSCL.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~

Any suggestions would be greatly appreciated.

Thanks Stew

Originally posted by stewart menday on ROS Answers with karma: 11 on 2020-10-28

Post score: 0


1 Answer 1


Rosanswers logo


In this repo you will find some basic ROS 2 examples. For example you should have a look to this CMakeLists.txt.

You should find_package:

find_package(rclcpp REQUIRED)

And then if it's a ROS 2 dependency, you should link against it

ament_target_dependencies(<you target name> rclcpp )

If it's not a ROS 2 dependency, then you should use the CMake functions. Like target_link_libraries or target_include_directories.


Originally posted by ahcorde with karma: 421 on 2020-10-29

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by stewart menday on 2020-10-29:
Thank you for your answer. I have been able to get it to work as follows, In my CMakeList.txt file I originally had

find_package(feetech_driver REQUIRED)

add_executable(joint_node src/joint_node.cpp)
ament_target_dependencies(joint_node rclcpp tutorial_interfaces feetech_driver ft_message)

Which didn't work, it wouldn't find the headers or the feetech_driver library file. After changing CMakeList.txt to

find_package(feetech_driver REQUIRED)
#don't know why the find_package(feetech_driver REQUIRED) above isn't sufficient, but need the 2 lines below
find_library(DRIVER ftd_scscl)
add_executable(joint_node src/joint_node.cpp)
ament_target_dependencies(joint_node rclcpp tutorial_interfaces feetech_driver ft_message)
target_include_directories(joint_node PUBLIC $<BUILD_INTERFACE:${HEADERS}>)
target_link_libraries(joint_node ${DRIVER})

It now works :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.