ROS2 error: can‘t find examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib

网友投稿 1375 2022-09-05

ROS2 error: can‘t find examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib

ROS2 error: can‘t find examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib

Windows10+ROS2 humble刚配置好,老规矩,跑一下ros2 examples,完整的教程在这里,

​​Using colcon to build packages — ROS 2 Documentation: Humble documentation​​

因为我只是测试,所以只是简单执行:

git clone src/examples -b humble colcon build --symlink-install --merge-install

然后报错:

CMake Error at ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:267 (message):   ament_cmake_symlink_install_targets() can't find  'D:/mc/ros2prj/example_ws/build/examples_rclcpp_minimal_subscriber/Release/wait_set_subscriber_library.lib' Call Stack (most recent call first):   ament_cmake_symlink_install_targets_3_Release.cmake:1 (ament_cmake_symlink_install_targets)   ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:323 (include)   cmake_install.cmake:36 (include)

根据报错提示,打开cmake文本看一下,

src\examples\rclcpp\topics\minimal_subscriber\CMakeLists.txt

发现里面有这么一条,

add_library(wait_set_subscriber_library SHARED     wait_set_subscriber.cpp     static_wait_set_subscriber.cpp     time_triggered_wait_set_subscriber.cpp) ament_target_dependencies(wait_set_subscriber_library rclcpp rclcpp_components std_msgs)

然后,在cpp项目中并没有找到RCLCPP_EXPORT这样的预定义,这是生成dll+lib所必须的;所以,根据默认的配置,只会生成dll文件,而不会有相应的lib文件;因此判断,这里在windows下,SHARED应该改成STATIC才行。修改后如下,

add_library(wait_set_subscriber_library STATIC     wait_set_subscriber.cpp     static_wait_set_subscriber.cpp     time_triggered_wait_set_subscriber.cpp) ament_target_dependencies(wait_set_subscriber_library rclcpp rclcpp_components std_msgs)

然后再执行colcon,这个cpp程序就编译成功了。

本文结束。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Kafka重要特性---幂等性
下一篇:MySQL索引,你知道有几种类型呢?(mysql常见索引类型有哪些)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~