ROS2 Basic Concept - Didn't get expected final result ON colcon build

Hi Everyone

I have follow, what i understand on the text.
when come to Example 1.4 copy the .cpp code i think it has some error. i don’t know what i should do on the code when have red underline.

Here is the message i get
Starting >>> my_package
— stderr: my_package
Traceback (most recent call last):

  • File “/opt/ros/dashing/share/ament_cmake_core/cmake/package_templates/”, line 21, in *
  • from ament_package.templates import get_environment_hook_template_path*
    ModuleNotFoundError: No module named ‘ament_package’
    CMake Error at /opt/ros/dashing/share/ament_cmake_core/cmake/ament_cmake_package_templates-extras.cmake:41 (message):
  • execute_process(/usr/bin/python3*
  • /opt/ros/dashing/share/ament_cmake_core/cmake/package_templates/*
  • /home/user/ros2_ws/build/my_package/ament_cmake_package_templates/templates.cmake)*
  • returned error code 1*
    Call Stack (most recent call first):
  • /opt/ros/dashing/share/ament_cmake_core/cmake/ament_cmake_coreConfig.cmake:38 (include)*
  • /opt/ros/dashing/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:15 (find_package)*
  • /opt/ros/dashing/share/ament_cmake/cmake/ament_cmakeConfig.cmake:38 (include)*
  • CMakeLists.txt:19 (find_package)*

make: *** [cmake_check_build_system] Error 1

Failed <<< my_package [0.18s, exited with code 2]

Summary: 0 packages finished [0.37s]

  • 1 package failed: my_package*
  • 1 package had stderr output: my_package*

Please assist
Thank you

Did you modify CMakeLists.txt as advised? The error is in that file.

I advise that you go carefully over the instructions and ensure nothing is missed.

I have the same issue :zipper_mouth_face:

Please let us know your exact issue and what you have done to try to solve it.