最近学习了一下Apollo3.0的perception模块的一部分代码,想要引用其中的min_box的模块,其中在重写convex_hullxy.h时,编译一直报如下错误:
1.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:(.data.rel.ro._ZTV14ConvexHull2DXYIN8pcl_util10PointXYZIHEE[_ZTV14ConvexHull2DXYIN8pcl_util10PointXYZIHEE]+0x60):对‘pcl::ConvexHull<pcl_util::PointXYZIH>::performReconstruction(pcl::PolygonMesh&)’未定义的引用
2.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:(.data.rel.ro._ZTV14ConvexHull2DXYIN8pcl_util10PointXYZIHEE[_ZTV14ConvexHull2DXYIN8pcl_util10PointXYZIHEE]+0x68):对‘pcl::ConvexHull<pcl_util::PointXYZIH>::performReconstruction(std::vector<pcl::Vertices, std::allocator<pcl::Vertices> >&)’未定义的引用
3.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:(.data.rel.ro._ZTVN3pcl10ConvexHullIN8pcl_util10PointXYZIHEEE[_ZTVN3pcl10ConvexHullIN8pcl_util10PointXYZIHEEE]+0x60):对‘pcl::ConvexHull<pcl_util::PointXYZIH>::performReconstruction(pcl::PolygonMesh&)’未定义的引用
4.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:(.data.rel.ro._ZTVN3pcl10ConvexHullIN8pcl_util10PointXYZIHEEE[_ZTVN3pcl10ConvexHullIN8pcl_util10PointXYZIHEEE]+0x68):对‘pcl::ConvexHull<pcl_util::PointXYZIH>::performReconstruction(std::vector<pcl::Vertices, std::allocator<pcl::Vertices> >&)’未定义的引用
5.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:在函数‘pcl::search::KdTree<pcl_util::PointXYZIH>::KdTree(bool)’中:
/usr/include/pcl-1.7/pcl/search/impl/kdtree.hpp:48:对‘pcl::KdTreeFLANN<pcl_util::PointXYZIH, flann::L2_Simple<float> >::KdTreeFLANN(bool)’未定义的引用
6.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:(.data.rel.ro._ZTVN3pcl6search17OrganizedNeighborIN8pcl_util10PointXYZIHEEE[_ZTVN3pcl6search17OrganizedNeighborIN8pcl_util10PointXYZIHEEE]+0x50):对‘pcl::search::OrganizedNeighbor<pcl_util::PointXYZIH>::nearestKSearch(pcl_util::PointXYZIH const&, int, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&) const’未定义的引用
7.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:(.data.rel.ro._ZTVN3pcl6search17OrganizedNeighborIN8pcl_util10PointXYZIHEEE[_ZTVN3pcl6search17OrganizedNeighborIN8pcl_util10PointXYZIHEEE]+0x70):对‘pcl::search::OrganizedNeighbor<pcl_util::PointXYZIH>::radiusSearch(pcl_util::PointXYZIH const&, double, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&, unsigned int) const’未定义的引用
8.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:在函数‘pcl::search::KdTree<pcl_util::PointXYZIH>::setSortedResults(bool)’中:
/usr/include/pcl-1.7/pcl/search/impl/kdtree.hpp:65:对‘pcl::KdTreeFLANN<pcl_util::PointXYZIH, flann::L2_Simple<float> >::setSortedResults(bool)’未定义的引用
9.
CMakeFiles/Multi_Sensor_Fusion.dir/minibbox.cpp.o:在函数‘pcl::search::OrganizedNeighbor<pcl_util::PointXYZIH>::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl_util::PointXYZIH> const> const&, boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)’中:
/usr/include/pcl-1.7/pcl/search/organized.h:146:对‘pcl::search::OrganizedNeighbor<pcl_util::PointXYZIH>::estimateProjectionMatrix()’未定义的引用
查了很多的资料都无法将这些问题解决,直到点进了这个网页:
https://stackoverflow.com/questions/44253353/linker-erros-with-pcl-1-8-0-project
然后在convex_hullxy.h的头文件部分做了如下修改:
修改方法:
#include "pcl/impl/pcl_base.hpp"
#include "pcl/kdtree/impl/kdtree_flann.hpp" //加上这两句话后错误5、8不再出现
#include "pcl/search/impl/organized.hpp"//加上这句话后错误6、7、9不再出现
#include "pcl/surface/impl/convex_hull.hpp"//加上这句话后其余错误不再出现