"sensor_msgs/msg/laserscan.hpp" does not work - was it forgotten to insert in the course?

Can it be that the package is not included in the course “ROS2 Basics in 5 days” Unit3??? I include the header “sensor_msgs/msg/laserscan.hpp”, add the CMakeLists with “find_package(sensor_msgs REQUIRED)” and with “ament_target_dependencies(test_node rclcpp std_msgs geometry_msgs sensor_msgs nav_msgs)” and added in package.xml “sensor_msgs”

And then comes the error (even if I immediately create a package with the dependency “sensor_msgs”)
/home/user/ros2_ws/src/test/src/sub.cpp:3:10: fatal error: sensor_msgs/msg/laserscan.hpp: No such file or directory
3 | #include “sensor_msgs/msg/laserscan.hpp”

  |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.
gmake[2]: *** [CMakeFiles/test_node.dir/build.make:76: CMakeFiles/test_node.dir/src/sub.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/test_node.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Hi @katae1 ,

Welcome to this Community!

The line #include "sensor_msgs/msg/laserscan.hpp" must be replaced with the following line:
#include "sensor_msgs/msg/laser_scan.hpp".

That should fix your issue.

Regards,
Girish

Thanks for the quick reply