ubuntu16.04ros编译时报错CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package): Could not find a package configuration file provided by "robot_audio" with any of the following names: robot_audioConfig.cmake robot_audio-config.cmake Add the installation prefix of "robot_audio" to CMAKE_PREFIX_PATH or set "robot_audio_DIR" to a directory containing one of the above files. If "robot_audio" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): bobac3_audio/CMakeLists.txt:10 (find_package) -- Configuring incomplete, errors occurred! See also "/home/oy/ros_workspace/build/CMakeFiles/CMakeOutput.log". See also "/home/oy/ros_workspace/build/CMakeFiles/CMakeError.log".
时间: 2024-03-20 13:39:27 浏览: 202
这个报错是因为在编译 bobac3_audio 时,需要依赖 robot_audio 这个包,但是系统找不到这个包。你可以尝试以下几个方法:
1. 确认你已经安装了 robot_audio 包。如果没有安装,可以使用以下命令安装:
```
sudo apt-get install ros-kinetic-robot-audio
```
2. 确认你的 CMAKE_PREFIX_PATH 环境变量是否包含了 robot_audio 包的安装路径。可以使用以下命令查看:
```
echo $CMAKE_PREFIX_PATH
```
如果没有包含 robot_audio 包的安装路径,可以使用以下命令设置:
```
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/opt/ros/kinetic/share/robot_audio
```
注意,这里的安装路径可能与你的实际安装路径不同,需要根据实际情况进行修改。
3. 如果以上两种方法都不行,可以尝试在 CMakeLists.txt 中手动指定 robot_audio 包的路径,例如:
```
find_package(robot_audio REQUIRED PATHS /opt/ros/kinetic/share/robot_audio/cmake)
```
这里的路径也需要根据实际情况进行修改。
相关问题
ubuntu16.04ros编译时报错home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:20:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 int cycle = 1; //巡航次数 ^ /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp: In member function ‘void Multipoint_Nav::move()’: /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:90:26: error: ‘goal’ does not name a type for(auto goal:pose) //遍历导航点列表 ^ In file included from /opt/ros/kinetic/include/ros/ros.h:40:0, from /opt/ros/kinetic/include/actionlib/client/simple_action_client.h:45, from /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:1: /opt/ros/kinetic/include/ros/console.h:373:3: error: expected ‘;’ before ‘do’ do \ ^ /opt/ros/kinetic/include/ros/console.h:561:35: note: in expansion of macro ‘ROS_LOG_COND’ #define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__) ^ /opt/ros/kinetic/include/rosconsole/macros_generated.h:110:23: note: in expansion of macro ‘ROS_LOG’ #define ROS_INFO(...) ROS_LOG(::ros::console::levels::Info, ROSCONSOLE_DEFAULT_ ^ /home/bobac3/ros_workspace/src/multipoint_navigation/src/multipoint_nav.cpp:152:17: note: in expansion of macro ‘ROS_INFO’ ROS_INFO("------------------loop ( %d ) termination!----------- ^ /opt/ros/kinetic/include/ros/console.h:373:3: error: expected primary-expression before ‘do’ do \ ^ /opt/ros/kinetic/include/ros/console.h:561:35: note: in expansion of macro ‘ROS_LOG_COND’ #define ROS_LOG(level, name, ...) ROS_LOG_COND(true, level, name, __VA_ARGS__) ^ /opt/ros/kinetic/include/rosconsole/macros_generated.h:110:23: note: in expansion of macro ‘ROS_LOG’ #define ROS_INFO(...) ROS_LOG(::ros::console::levels::Info, ROSCONSOLE_DEFAULT_
这个错误的原因是代码中使用了 C++11 的特性,但是编译时没有开启 C++11 标准。你需要在编译时加上选项 -std=c++11 或者 -std=gnu++11 来开启 C++11 标准。
具体来说,在你的 CMakeLists.txt 文件中添加以下行:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
这将会把 C++11 标准的编译选项加入到编译命令中,从而解决这个问题。
另外,还有一个错误是 'goal' does not name a type,这可能是因为你没有在代码中定义 goal 变量的类型。你需要检查一下代码中是否有定义 goal 变量的类型,并且确保它在使用之前已经被定义。
ubuntu16.04运行时报错CMake Error at bobac2_description/CMakeLists.txt:147 (add_dependencies): Cannot add target-level dependencies to non-existent target "bobac2_description_node". The add_dependencies works for top-level logical targets created by the add_executable, add_library, or add_custom_target commands. If you want to add file-level dependencies see the DEPENDS option of the add_custom_target and add_custom_command commands. CMake Error at bobac2_description/CMakeLists.txt:150 (target_link_libraries): Cannot specify link libraries for target "bobac2_description_node" which is not built by this project. -- Configuring incomplete, errors occurred! See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeOutput.log". See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeError.log". Makefile:2796: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1 CMake Error at bobac2_description/CMakeLists.txt:147 (add_dependencies): Cannot add target-level dependencies to non-existent target "bobac2_description_node". The add_dependencies works for top-level logical targets created by the add_executable, add_library, or add_custom_target commands. If you want to add file-level dependencies see the DEPENDS option of the add_custom_target and add_custom_command commands. CMake Error at bobac2_description/CMakeLists.txt:150 (target_link_libraries): Cannot specify link libraries for target "bobac2_description_node" which is not built by this project. -- Configuring incomplete, errors occurred! See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeOutput.log". See also "/home/bobac3/ros_workspace/build/CMakeFiles/CMakeError.log". Makefile:2796: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1
这个错误可能是因为在运行CMake时,找不到名为"bobac2_description_node"的目标。这可能是因为在CMakeLists.txt文件中没有正确地定义目标或源文件。您可以检查一下CMakeLists.txt文件中的目标和源文件是否正确定义。另外,您可以尝试清理并重新构建项目,以确保没有编译错误。您也可以查看CMakeError.log和CMakeOutput.log文件,以获取更多关于错误的详细信息。
阅读全文