ROS未定义的引用

ROS未定义的引用

  • ROS移植yolov4过程中出现报错
  • 解决:升级cmake3.9.2至3.15.6
  • 参考

ROS移植yolov4过程中出现报错

Ubuntu18.04

[100%] Linking CXX executable /home/z/catkin_ws/devel/lib/darknet_ros/darknet_ros
CMakeFiles/darknet_ros.dir/src/yolo_object_detector_node.cpp.o:在函数‘main’中:
/home/z/catkin_ws/src/darknet_ros-master/darknet_ros/src/yolo_object_detector_node.cpp:15:对‘darknet_ros::YoloObjectDetector::YoloObjectDetector(ros::NodeHandle)’未定义的引用
/home/z/catkin_ws/src/darknet_ros-master/darknet_ros/src/yolo_object_detector_node.cpp:15:对‘darknet_ros::YoloObjectDetector::~YoloObjectDetector()’未定义的引用
/home/z/catkin_ws/src/darknet_ros-master/darknet_ros/src/yolo_object_detector_node.cpp:15:对‘darknet_ros::YoloObjectDetector::~YoloObjectDetector()’未定义的引用
collect2: error: ld returned 1 exit status
darknet_ros-master/darknet_ros/CMakeFiles/darknet_ros.dir/build.make:186: recipe for target '/home/z/catkin_ws/devel/lib/darknet_ros/darknet_ros' failed
make[2]: *** [/home/z/catkin_ws/devel/lib/darknet_ros/darknet_ros] Error 1
CMakeFiles/Makefile2:2060: recipe for target 'darknet_ros-master/darknet_ros/CMakeFiles/darknet_ros.dir/all' failed
make[1]: *** [darknet_ros-master/darknet_ros/CMakeFiles/darknet_ros.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

解决:升级cmake3.9.2至3.15.6

注意:不要直接卸载旧版本!否则需要重装ROS!

  1. 查看版本
cmake --version
  1. 文件下载 解压并移到/opt下
wget https://cmake.org/files/v3.15/cmake-3.15.6-Linux-x86_64.tar.gz
tar -xzvf cmake-3.15.6-Linux-x86_64.tar.gz
sudo mv cmake-3.15.6-Linux-x86_64 /opt/cmake-3.15.6
  1. 建立软链接
sudo ln -sf /opt/cmake-3.15.6/bin/* /usr/bin/
  1. 确认是否安装成功
cmake --version
  1. 将cmake的文件路径添加至 .bashrc里面,保存并更新
export  PATH=$PATH:/opt/cmake-3.15.6/bin
source ~/.bashrc 

参考

ubuntu16.04 Cmake版本升级3.12

你可能感兴趣的:(CV,linux,cmake,ubuntu)