catkin_package() the catkin package 'roscpp' has been find_package()-ed but is not listed as a build dependency in the package.xml
时间: 2024-04-22 07:27:56 浏览: 240
This warning usually occurs when the 'roscpp' package is used in your code, but it is not listed as a build dependency in the package.xml file of your catkin package.
To resolve this issue, you need to add 'roscpp' as a build dependency in the package.xml file. Open the package.xml file of your catkin package and locate the `<build_depend>` section. Add the following line within the `<build_depend>` section:
```
<build_depend>roscpp</build_depend>
```
Save the file and rebuild your catkin workspace. This should resolve the warning.
相关问题
at /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:196 (message): catkin_package() the catkin package 'std_msgs' has been find_package()-ed but is not listed as a build dependency in the package.xml
这个ROS构建错误的提示信息是由于你的ROS包中使用了std_msgs,但是在package.xml中没有将其列为构建依赖项导致的。
解决方法:在你的package.xml文件中添加std_msgs为构建依赖项。你可以将以下代码添加到package.xml文件中的<build_depend>标签中:
```
<build_depend>std_msgs</build_depend>
```
然后重新构建你的ROS包,这个错误就会消失了。
如何解决该报错:- +++ processing catkin package: 'custom_dynamic_reconfigure' -- ==> add_subdirectory(custom_dynamic_reconfigure) CMake Error at /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:196 (message): catkin_package() the catkin package 'std_msgs' has been find_package()-ed but is not listed as a build dependency in the package.xml Call Stack (most recent call first): /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package) custom_dynamic_reconfigure/CMakeLists.txt:11 (catkin_package) -- Configuring incomplete, errors occurred! See also "/home/czj/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/czj/catkin_ws/build/CMakeFiles/CMakeError.log". make: *** [Makefile:614:cmake_check_build_system] 错误 1 Invoking "make cmake_check_build_system" failed
解决该报错的方法是在 package.xml 中添加 std_msgs 作为构建依赖项。
具体步骤如下:
1. 进入到该 catkin 包的目录下,找到 package.xml 文件。
2. 在 `<build_depend>` 和 `<run_depend>` 中分别添加 std_msgs,如下所示:
```
<build_depend>std_msgs</build_depend>
<run_depend>std_msgs</run_depend>
```
3. 保存文件并重新构建该 catkin 包,报错应该会消失。
如果还有其他报错,可以查看 `/home/czj/catkin_ws/build/CMakeFiles/CMakeError.log` 和 `/home/czj/catkin_ws/build/CMakeFiles/CMakeOutput.log` 文件,寻找更多信息。
阅读全文