【ROS】 编译报错 与cmake版本

在编译深蓝学院的包时报以下错

[ 92%] Linking CXX executable /home/zzh/workspace/e_ws/devel/lib/grid_path_searcher/demo_node
CMakeFiles/demo_node.dir/src/demo_node.cpp.o:在函数‘pathFinding(Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1>)’中:
demo_node.cpp:(.text+0x8d3):对‘AstarPathFinder::AstarGraphSearch(Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1>)’未定义的引用
demo_node.cpp:(.text+0x8e0):对‘AstarPathFinder::getPath()’未定义的引用
demo_node.cpp:(.text+0x8ed):对‘AstarPathFinder::getVisitedNodes()’未定义的引用
demo_node.cpp:(.text+0xab6):对‘AstarPathFinder::resetUsedGrids()’未定义的引用
CMakeFiles/demo_node.dir/src/demo_node.cpp.o:在函数‘rcvPointCloudCallBack(sensor_msgs::PointCloud2_<std::allocator<void> > const&)’中:
demo_node.cpp:(.text+0x1104):对‘AstarPathFinder::setObs(double, double, double)’未定义的引用
demo_node.cpp:(.text+0x1131):对‘AstarPathFinder::setObs(double, double, double)’未定义的引用
demo_node.cpp:(.text+0x1172):对‘AstarPathFinder::coordRounding(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)’未定义的引用
CMakeFiles/demo_node.dir/src/demo_node.cpp.o:在函数‘JPSPathFinder::JPSPathFinder()’中:
demo_node.cpp:(.text._ZN13JPSPathFinderC2Ev[_ZN13JPSPathFinderC5Ev]+0x4d):对‘JPS3DNeib::JPS3DNeib()’未定义的引用
CMakeFiles/demo_node.dir/src/demo_node.cpp.o:在函数‘main’中:
demo_node.cpp:(.text.startup+0x7d9):对‘AstarPathFinder::initGridMap(double, Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1>, int, int, int)’未定义的引用
demo_node.cpp:(.text.startup+0x861):对‘AstarPathFinder::initGridMap(double, Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1>, int, int, int)’未定义的引用
collect2: error: ld returned 1 exit status
grid_path_searcher/CMakeFiles/demo_node.dir/build.make:420: recipe for target '/home/zzh/workspace/e_ws/devel/lib/grid_path_searcher/demo_node' failed
make[2]: *** [/home/zzh/workspace/e_ws/devel/lib/grid_path_searcher/demo_node] Error 1
CMakeFiles/Makefile2:1624: recipe for target 'grid_path_searcher/CMakeFiles/demo_node.dir/all' failed
make[1]: *** [grid_path_searcher/CMakeFiles/demo_node.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

我修改了 功能包 CMakeLists.txt 文件的   cmake_minimum_required(VERSION 2.8.3)

cmake_minimum_required(VERSION 3.0.2) (与工作空间的CMakeLists.txt 文件一致)
后 便可正常编译 ,随后切换回之前版本 也能正常编译
posted @ 2021-11-01 10:33  星火-AI  阅读(495)  评论(0编辑  收藏  举报