fatal error: geometry_msgs/msg/detail/point32__struct.hpp: No such file or directory
127 | #include "geometry_msgs/msg/detail/point32__struct.hpp"
.
But this file exists and I accessed to see whats going on.
And saw this clang error : not_found
This seems to affect following code either as you can see below.
.
I also checked geometry_msgs/msg/detail/point__struct.hpp
which is very similar to that point32 file.
And this file doesnt have any issue to link cpp files.
Please don’t consider the error warnings produced by the IDE. The IDE cannot find certain files and functions even if they are defined and present. The only errors you should take into notice are the ones produced during colcon build.
You can not and should not change any installed files. So knowing those files are present is good, but trying to make any changes to those files would be a bad idea.
What error does your colcon build report? Could you copy-paste the complete compilation error outputs here?
Also, please post your CMakeLists.txt file contents as a Markdown formatted text.
You can use Pose2D instead of Point or Point32 message type.
Hi @girishkumar.kannan,
Yup, i thought it would be very bad idea to touch these files.
So no worries, i did care very much about no change.
Below is the whole error message i got:
user:~/ros2_ws$ colcon build --packages-select rosject_msg
Starting >>> rosject_msg
--- stderr: rosject_msg
In file included from /home/user/ros2_ws/build/rosject_msg/rosidl_typesupport_introspection_cpp/rosject_msg/action/detail/odom_record__type_support.cpp:12:
/home/user/ros2_ws/build/rosject_msg/rosidl_generator_cpp/rosject_msg/action/detail/odom_record__struct.hpp:127:10: fatal error: geometry_msgs/msg/detail/point32__struct.hpp: No such file or directory
127 | #include "geometry_msgs/msg/detail/point32__struct.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/rosject_msg__rosidl_typesupport_introspection_cpp.dir/build.make:119: CMakeFiles/rosject_msg__rosidl_typesupport_introspection_cpp.dir/rosidl_typesupport_introspection_cpp/rosject_msg/action/detail/odom_record__type_support.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:369: CMakeFiles/rosject_msg__rosidl_typesupport_introspection_cpp.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< rosject_msg [3.42s, exited with code 2]
Summary: 0 packages finished [3.67s]
1 package failed: rosject_msg
1 package had stderr output: rosject_msg
user:~/ros2_ws$
CMakeLists is following:
cmake_minimum_required(VERSION 3.8)
project(rosject_msg)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
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 dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(action_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
"srv/FindWall.srv"
"action/OdomRecord.action"
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
I think you have forgotten to include geometry_msgs as a dependency in your rosject_msg package.
Also include geometry_msgs and nav_msgs as dependencies to your main package.
You need to edit the CMakeLists.txt and package.xml files of each package to include the above dependencies.
That should solve your problem. Let me know if you still have issues after doing the above steps in this post.
Hi @girishkumar.kannan
I had checked CMakeLists and package.xml many times.
I included nav_msgs since it include geometry_msgs as well,
but it didnt work, so i removed from this interface for now.
I just saw your CMakeLists.txt file for rosject_msg package (since you posted it late).
If you are using ROS2 Galactic or Humble, you should also include the following line in the rosidl_generate_interfaces() block in your CMakeLists.txt file:
rosidl_generate_interfaces(${PROJECT_NAME}
"srv/FindWall.srv"
"action/OdomRecord.action"
DEPENDENCIES std_msgs geometry_msgs # <--- add this line
)