在编译pcl中octree官方提供代码示例时报错undefined reference to `pcl::octree::OctreePointCloud问题解决

在编译octree官方提供代码示例时出现很多undefined reference to...如下所示:

/usr/bin/ld: CMakeFiles/octree_change_detection.dir/octree_change_detection.cpp.o: in function `main':
octree_change_detection.cpp:(.text+0x2ca): undefined reference to `pcl::octree::OctreePointCloud<pcl::PointXYZ, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty> >::addPointsFromInputCloud()'
/usr/bin/ld: octree_change_detection.cpp:(.text+0x2d9): undefined reference to `pcl::octree::Octree2BufBase<pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty>::switchBuffers()'

 解决办法:

查看报错信息添加对应的.h和.cpp文件

 最终编译成功。

如果还不能解决问题,那就重装pcl吧,尽量安装低版本一些。

在运行range image官方demo时也出现一大堆undefined,最后是通过将pcl1.12.0卸载了,重装pcl1.9.1问题得到了解决。

猜你喜欢

转载自blog.csdn.net/qq_49959714/article/details/129369070