ros catkin_make 出现add_custom_target cannot create target 错误

今天用catkin_make编译ros包出现如下错误:

CMake Error at /home/liwei/work/catkin_ws_land/build/mycommbase/cmake/mycommbase-genmsg.cmake:250 (add_custom_target):
  add_custom_target cannot create target
  "mycommbase_generate_messages_nodejs" because another target with the same
  name already exists.  The existing target is a custom target created in
  source directory "/home/liwei/work/catkin_ws_land/src/tld_tracker".  See
  documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
  mycommbase/CMakeLists.txt:20 (generate_messages)

最后的找到的原因是包的package.xml  中包依赖没有和cmakelist.txt中设置一致

cmakelist.txt:

find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs image_transport  mycommbase  message_generation)


package.xml:

  <build_depend>message_generation</build_depend>
    <build_depend>mycommbase</build_depend>
    <build_depend>image_transport</build_depend>


  <run_depend>message_runtime</run_depend>
    <run_depend>mycommbase</run_depend>
        <run_depend>image_transport</run_depend>

主要是上面mycommbase是我自己的一个包,一定要在package.xml中  <build_depend> 里面加上

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值