Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

fatal error: dds/domain/DomainParticipant.hpp: No such file or directory

Hi, I'm trying to create a string ROS-2 application using RTI ROS-DATA-TYPES[.idl], in below code I have generated the header for String.idl and using that header in my application. When I tried to compile I get FATAL ERROR for the headers of headers file.. I have manually included path for the string.hpp in my camke. but the headers of string.hpp can not find its header shown below.

include "std_msgs/msg/String.hpp"

using namespace std::chrono_literals;

int main(int argc, char * argv[])
  rclcpp::init(argc, argv);

  auto node = rclcpp::Node::make_shared("publisher");
  auto publisher = node->create_publisher<std_msgs::msg::string>("topic", 10);

  std_msgs::msg::String message;
  auto publish_count = 0;
  rclcpp::WallRate loop_rate(500ms);

  while (rclcpp::ok()) { = "Hello, world! ";
    std::cout<<publish_count++<< message.data_<<="" std::endl;="" publisher-="">publish(message);
  return 0;

CMAKE FILE: cmake_minimum_required(VERSION 3.5) project(simple_test) if(NOT CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 99) endif() if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(std_msgs REQUIRED) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() endif() include_directories(/home/z0013488/ros-data-types/install/include) add_executable(my_test src/test.cpp) ament_target_dependencies(my_test rclcpp std_msgs) install(TARGETS my_test DESTINATION lib/${PROJECT_NAME} ) install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/ ) ament_package()
enter code here

Starting >>> simple_test --- stderr: simple_test
In file included from /home/z0013488/ros2_dashing/src/simple_test/src/test.cpp:5:0: /home/z0013488/ros-data-types/install/include/std_msgs/msg/String.hpp:24:10: fatal error: dds/domain/DomainParticipant.hpp: No such file or directory #include "dds/domain/DomainParticipant.hpp" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. gmake[2]: * [CMakeFiles/my_test.dir/src/test.cpp.o] Error 1 gmake[1]: [CMakeFiles/my_test.dir/all] Error 2 gmake: ** [all] Error 2 Failed <<< simple_test [ Exited with code 2 ] Summary: 0 packages finished [1.28s] 1 package failed: simple_test 1 package had stderr output: simple_test

enter code here