自建引用包报错:CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):

报错内容:

CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "common" with any
  of the following names:

    commonConfig.cmake
    common-config.cmake

  Add the installation prefix of "common" to CMAKE_PREFIX_PATH or set
  "common_DIR" to a directory containing one of the above files.  If "common"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  lidar_location/CMakeLists.txt:37 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/wsk/8359_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/wsk/8359_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

报错截图

        详情描述:其中common包属于自建包,里面存放共有文件,其他执行文件需要访问该包,并运行包内的头文件。报错内容为找不到这个包,如果读者找不到其他ROS的SDK包,可以直接使用命令下载即可,命令如下,不属于本问题所述情况。

sudo apt-get install ros-melodic-sdk名称

        解决方法原理,ros运行各个包是无序的,因此运行其他包的时候,没有先运行common包,故而报这个类型的错误。解决办法,按顺序执行,先运行common包,在运行其他包即可。

方法一:特别笨的

删除其他包,只保留common自建包,运行一次,在把其他包复原。重新catkin_make,解决。

方法二:解决根源

在其他包的package.xml文件里加入一个

<depend>common</depend>

在CMakeLists.txt文件的中加入common

find_package(catkin REQUIRED COMPONENTS

common

)

经过以上就解决了。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值