无法链接PCL库undefined reference to `pcl::PCLBase****

104 篇文章 6 订阅
47 篇文章 2 订阅

环境

Ubuntu 14.04 +ROS Indigo +PCL 1.8

报错日志

../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::PCLBase()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::deinitCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::showCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&, std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::~CloudViewer()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::CloudViewer(std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > > const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::VoxelGrid<pcl::PointXYZRGBA>::applyFilter(pcl::PointCloud<pcl::PointXYZRGBA>&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::initCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<pcl::PointIndices const> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [../Examples/Stereo/stereo_kitti] Error 1
make[1]: *** [CMakeFiles/stereo_kitti.dir/all] Error 2
[100%] Linking CXX executable ../Examples/Stereo/stereo_euroc
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::PCLBase()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::deinitCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::showCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&, std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::~CloudViewer()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::CloudViewer(std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > > const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::VoxelGrid<pcl::PointXYZRGBA>::applyFilter(pcl::PointCloud<pcl::PointXYZRGBA>&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::initCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<pcl::PointIndices const> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [../Examples/RGB-D/rgbd_tum] Error 1
make[1]: *** [CMakeFiles/rgbd_tum.dir/all] Error 2
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::PCLBase()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::deinitCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::showCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&, std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::~CloudViewer()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::CloudViewer(std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > > const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::VoxelGrid<pcl::PointXYZRGBA>::applyFilter(pcl::PointCloud<pcl::PointXYZRGBA>&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::initCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<pcl::PointIndices const> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [../Examples/Monocular/mono_tum] Error 1
make[1]: *** [CMakeFiles/mono_tum.dir/all] Error 2
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::PCLBase()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::deinitCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::showCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&, std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::~CloudViewer()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::visualization::CloudViewer::CloudViewer(std::string const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<std::vector<int, std::allocator<int> > > const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::VoxelGrid<pcl::PointXYZRGBA>::applyFilter(pcl::PointCloud<pcl::PointXYZRGBA>&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::initCompute()'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
../lib/libORB_SLAM2.so: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(boost::shared_ptr<pcl::PointIndices const> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [../Examples/Stereo/stereo_euroc] Error 1
make[1]: *** [CMakeFiles/stereo_euroc.dir/all] Error 2
make: *** [all] Error 2

解决

CMakeLists.txt中加入以下内容:

find_package (PCL 1.8 REQUIRED)

set(PCL_INCLUDE_DIRS /usr/local/include/pcl-1.8)  #指定pcl1.8路径

add_definitions(${PCL_DEFINITIONS})

include_directories( ... ${PCL_INCLUDE_DIRS})

target_link_libraries( ... ${PCL_LIBRARIES})
  • 6
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值