紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
Could not find a package configuration file provided by [cmake] "village_interfaces" with any of the following names: village_interfacesConfig.cmake
-
系统:Win11+WSL2-Ubuntu22.04
VSCode编译报错信息:
[main] 正在配置项目: zhjrROS2 [proc] 执行命令: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/mnt/c/Users/zhjr/zhjrProjects/zhjrROS2/src/village_wang_cpp -B/mnt/c/Users/zhjr/zhjrProjects/zhjrROS2/build -G Ninja [cmake] Not searching for unused variables given on the command line. [cmake] -- Found ament_cmake: 1.3.6 (/opt/ros/humble/share/ament_cmake/cmake) [cmake] -- Found rclcpp: 16.0.7 (/opt/ros/humble/share/rclcpp/cmake) [cmake] -- Found rosidl_generator_c: 3.1.5 (/opt/ros/humble/share/rosidl_generator_c/cmake) [cmake] -- Found rosidl_adapter: 3.1.5 (/opt/ros/humble/share/rosidl_adapter/cmake) [cmake] -- Found rosidl_generator_cpp: 3.1.5 (/opt/ros/humble/share/rosidl_generator_cpp/cmake) [cmake] -- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c [cmake] -- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp [cmake] -- Found rmw_implementation_cmake: 6.1.1 (/opt/ros/humble/share/rmw_implementation_cmake/cmake) [cmake] -- Found rmw_fastrtps_cpp: 6.2.5 (/opt/ros/humble/share/rmw_fastrtps_cpp/cmake) [cmake] -- Using RMW implementation 'rmw_fastrtps_cpp' as default [cmake] CMake Error at CMakeLists.txt:14 (find_package): [cmake] By not providing "Findvillage_interfaces.cmake" in CMAKE_MODULE_PATH this [cmake] project has asked CMake to find a package configuration file provided by [cmake] "village_interfaces", but CMake did not find one. [cmake] [cmake] Could not find a package configuration file provided by [cmake] "village_interfaces" with any of the following names: [cmake] [cmake] village_interfacesConfig.cmake [cmake] village_interfaces-config.cmake [cmake] [cmake] Add the installation prefix of "village_interfaces" to CMAKE_PREFIX_PATH or [cmake] set "village_interfaces_DIR" to a directory containing one of the above [cmake] files. If "village_interfaces" provides a separate development package or [cmake] SDK, be sure it has been installed. [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] See also "/mnt/c/Users/zhjr/zhjrProjects/zhjrROS2/build/CMakeFiles/CMakeOutput.log". [proc] 命令“/usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/mnt/c/Users/zhjr/zhjrProjects/zhjrROS2/src/village_wang_cpp -B/mnt/c/Users/zhjr/zhjrProjects/zhjrROS2/build -G Ninja”已退出,代码为 1
CMakeList.txt
cmake_minimum_required(VERSION 3.8) project(village_wang_cpp) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() # find dependencies find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(std_msgs REQUIRED) find_package(village_interfaces REQUIRED) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) # the following line skips the linter which checks for copyrights # comment the line when a copyright and license is added to all source files set(ament_cmake_copyright_FOUND TRUE) # the following line skips cpplint (only works in a git repo) # comment the line when this package is in a git repo and when # a copyright and license is added to all source files set(ament_cmake_cpplint_FOUND TRUE) ament_lint_auto_find_test_dependencies() endif() ament_package() add_executable(wang2 src/wang2.cpp) ament_target_dependencies(wang2 rclcpp std_msgs village_interfaces) install(TARGETS wang2 DESTINATION lib/${PROJECT_NAME}) install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
package.xml
<?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <package format="3"> <name>village_wang_cpp</name> <version>0.0.0</version> <description>TODO: Package description</description> <maintainer email="*********@qq.com">zhjr</maintainer> <license>Apache-2.0</license> <buildtool_depend>ament_cmake</buildtool_depend> <depend>rclcpp</depend> <depend>std_msgs</depend> <depend>village_interfaces</depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <export> <build_type>ament_cmake</build_type> </export> </package>