example_interfaces, no such file or directory
Hello
I created a ros2 C++ node, in which I use example_interface.
However, when I use "colcon" to build the package I face the error " fatal error: example_interfaces/msg/string.hpp: No such file or directory".
I included the heading: #include "example_interfaces/msg/string.hpp"
I added it in my package.xml file and also update CMakeList.txt
cmake_minimum_required(VERSION 3.8)
project(my_cpp_pkg)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(example_interfaces REQUIRED)
add_executable(cpp_node src/my_first_node.cpp)
#amnet_target_dependencies (cpp_node rclcpp)
target_link_libraries (cpp_node rclcpp::rclcpp)
add_executable(robot_news_station src/robot_news_station.cpp)
target_link_libraries (robot_news_station rclcpp::rclcpp example_interfaces::example_interfaces)
#target_link_libraries (robot_news_station rclcpp::example_interfaces)
#amnet_target_dependencies (robot_news_station rclcpp example_interfaces)
install (TARGETS
cpp_node
robot_news_station
DESTINATION lib/${PROJECT_NAME}
)
ament_package()
Can anyone advise me on why this happens?