ROS2 colcon build出现Could not find a package configuration file provided by “ament_cmake“

ROS2 colcon build出现Could not find a package configuration file provided by “ament_cmake”

问题描述

在编译ROS2时,采用colcon build编译,出现

CMake Error at CMakeLists.txt:19 (find_package):
  By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "ament_cmake", but CMake did not find one.

  Could not find a package configuration file provided by "ament_cmake" with
  any of the following names:

    ament_cmakeConfig.cmake
    ament_cmake-config.cmake

  Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
  "ament_cmake_DIR" to a directory containing one of the above files.  If
  "ament_cmake" provides a separate development package or SDK, be sure it
  has been installed.

解决办法:
将原来的指令

colcon build

修改为

source /opt/ros/foxy/setup.bash && colcon build --symlink-install

猜你喜欢

转载自blog.csdn.net/weixin_41868104/article/details/126829535