add_custom_target cannot create target

文章讲述了在使用CMake构建ROS包时遇到的错误,指出CMakeLists.txt和package.xml之间的对应关系以及如何通过移除不必要的build_depend项解决编译冲突,重点在于处理IT开发中的依赖管理问题。
摘要由CSDN通过智能技术生成

出现以下错误
CMake Error at /home/zh/catkin_ws/build/household_objects_database_msgs/cmake/household_objects_database_msgs-genmsg.cmake:250 (add_custom_target):
add_custom_target cannot create target
“household_objects_database_msgs_generate_messages_eus” because another
target with the same name already exists. The existing target is a custom
target created in source directory

经搜索,知道
CMakeLists.txt 和package.xml 要对应。
即:
CMakeLists.txt
find_package(catkin REQUIRED COMPONENTS
actionlib
control_msgs
diagnostic_msgs
geometry_msgs
manipulation_msgs
moveit_msgs
moveit_ros_perception
moveit_ros_planning_interface
roscpp
rospy
sensor_msgs
shape_msgs
std_msgs
std_srvs
tf
trajectory_msgs
)

对应的
package.xml
必须加入
<build_depend>actionlib</build_depend>
<build_depend>control_msgs</build_depend>
<build_depend>diagnostic_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>manipulation_msgs</build_depend>
<build_depend>moveit_msgs</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>shape_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>std_srvs</build_depend>
<build_depend>tf</build_depend>

编译还是出错:
然后把其中这个注释掉:
<build_depend>geometry_msgs</build_depend>
编译通过

  • 6
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值