环境:
ubuntu 20.04 , PCL 1.11.0
利用CMake编译PCL时编译报错:

/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE[_ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE]+0x20): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE[_ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE]+0x28): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > > const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE[_ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE]+0x30): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE[_ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE]+0x38): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<pcl::PointIndices const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE[_ZTVN3pcl7PCLBaseINS_12PointXYZRGBAEEE]+0x40): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_12PointXYZRGBAEEE[_ZTVN3pcl6FilterINS_12PointXYZRGBAEEE]+0x20): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_12PointXYZRGBAEEE[_ZTVN3pcl6FilterINS_12PointXYZRGBAEEE]+0x28): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > > const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_12PointXYZRGBAEEE[_ZTVN3pcl6FilterINS_12PointXYZRGBAEEE]+0x30): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_12PointXYZRGBAEEE[_ZTVN3pcl6FilterINS_12PointXYZRGBAEEE]+0x38): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<pcl::PointIndices const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_12PointXYZRGBAEEE[_ZTVN3pcl6FilterINS_12PointXYZRGBAEEE]+0x40): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE[_ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE]+0x20): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE[_ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE]+0x28): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > > const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE[_ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE]+0x30): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE[_ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE]+0x38): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(std::shared_ptr<pcl::PointIndices const> const&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE[_ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE]+0x40): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/voslam.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE[_ZTVN3pcl9VoxelGridINS_12PointXYZRGBAEEE]+0x48): undefined reference to `pcl::VoxelGrid<pcl::PointXYZRGBA>::applyFilter(pcl::PointCloud<pcl::PointXYZRGBA>&)'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/pointcloudmapping.cpp.o: in function `PointCloudMapping::PointCloudMapping(double)':
pointcloudmapping.cpp:(.text+0x1ac): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::PCLBase()'
/usr/bin/ld: CMakeFiles/MYSLAM.dir/src/pointcloudmapping.cpp.o: in function `PointCloudMapping::viewer()':
pointcloudmapping.cpp:(.text+0x1626): undefined reference to `pcl::visualization::CloudViewer::CloudViewer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x1d39): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&)'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x1d66): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::initCompute()'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x1db5): undefined reference to `pcl::VoxelGrid<pcl::PointXYZRGBA>::applyFilter(pcl::PointCloud<pcl::PointXYZRGBA>&)'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x1dbd): undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>::deinitCompute()'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x1ff7): undefined reference to `pcl::visualization::CloudViewer::showCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> const> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x24dd): undefined reference to `pcl::VoxelGrid<pcl::PointXYZRGBA>::applyFilter(pcl::PointCloud<pcl::PointXYZRGBA>&)'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x263d): undefined reference to `pcl::visualization::CloudViewer::~CloudViewer()'
/usr/bin/ld: pointcloudmapping.cpp:(.text+0x2798): undefined reference to `pcl::visualization::CloudViewer::~CloudViewer()'
collect2: error: ld returned 1 exit status

解决方法:
手动指定PCL的头文件和链接库:

# find_package(PCL 1.11.0 EXACT REQUIRED)
# add_definitions( ${PCL_DEFINITIONS} )-------修改为---:
file(GLOB PCL_LIBRARIES /usr/local/lib/libpcl_*)
set(PCL_INCLUDE_DIRS /usr/local/include/pcl-1.11)INCLUDE_DIRECTORIES(${PROJECT_NAME} ${PCL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PCL_LIBRARIES})

解决PCL 编译报错:undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>:: XXX相关推荐

  1. 记录一个CMake编译报错undefined reference to vtable问题的解决

    在编写一个简单的CMake demo: 问题描述 文件结构如下:头文件和cpp分别放在两个文件夹下面 如果使用下面的写法,会报错"undefined reference to vtable ...

  2. linux使用gcc编译报错“undefined reference to `pthread_create'”

    下面这个例子通过一个代码说明两个线程关联一个函数,实现并发操作,预期结果这两个线程都使用了print函数,它们各自执行各自的,不会因为使用了同一个函数而受到影响. my_test.cpp #inclu ...

  3. 编译报错: undefined reference to `pcl::console::print(pcl::console::VERBOSITY_LEVEL, char const*, ...)‘

    写在前面 自己在写一个调用 pcl 的程序,编译的时候遇到如下问题: In function `void pcl::detail::FieldMapper<pcl::PointXYZ>:: ...

  4. C++编译报错: undefined reference to clock_gettime

    在编译C++代码时有时候会出现以下错误,作者是在编译librdkafka的时候遇到的,现在与各位网友分享并提供解决方案. Makefile中缺少依赖库:-lrt 如下图: 将依赖项添加到Makefil ...

  5. Deeplab 在Qt Creator下编译报错undefined reference to Mat_xxx

    https://github.com/TheLegendAli/DeepLab-Context/issues/8 1. 修改工程根目录下的CMakeLists.txt 末尾加上 find_packag ...

  6. 解决交叉编译连接器包含-ldl编译选项,但仍然报错undefined reference to ‘__dlsym‘

    交叉编译连接器包含-ldl编译选项,但仍然报错undefined reference to '__dlsym' 文章目录 交叉编译连接器包含-ldl编译选项,但仍然报错undefined refere ...

  7. pthread_create函数编译时报错:undefined reference to 'pthread_create'

    错误: pthread_create函数编译时报错:undefined reference to 'pthread_create' pthread_create()和pthread_atfork()函 ...

  8. Eclipse中更改JDK版本,解决ant编译报错的问题

    要改一个JDK版本 主要是为了解决ant编译报错,JDK版本不一致的问题. 1. Windows--Preferences--Java--Compiler(配置的为1.8)--Installed JR ...

  9. 快速解决Android编译报错 : Manifest merger failed with multiple errors, see logs

    快速解决Android编译报错 : Manifest merger failed with multiple errors, see logs 编译项目的时候,遇到Android Manifest合并 ...

  10. amd64上编译pcl报错undefined reference to `png_init_filter_functions_neon‘

    vtk编译没问题,但pcl报错,这是因为arm架构下与pcl编译相关的部分vtk库编译有所偏差,把vtk下thirdparty/png/vtkpng/png private.h的第128到133行注释 ...

最新文章

  1. 《Android App开发入门:使用Android Studio 2.X开发环境》——导读
  2. leetcode 41. First Missing Positive
  3. CodeForces - 1463E Plan of Lectures(拓扑排序+并查集缩点)
  4. 28. css样式中px转rem
  5. Spring 构造注入 传參数
  6. stm32linux区别,STM32MPU和OpenSTLinux你了解多少?
  7. LOJ3119 CTS2019 随机立方体 概率、容斥、二项式反演
  8. 在IIS6上部署MVC2网站(续篇)
  9. 深度学习——loss函数的学习笔记(legacy)
  10. LEARNING TO EXPLORE USING ACTIVE NEURAL SLAM
  11. 计算机的启动盘,做win7启动盘制作方法
  12. kinect v2 相机标定
  13. JSON.stringify(value, replacer, space)详解
  14. C# XNA 简单的 迷宫游戏
  15. oracle 表名 添加注释
  16. 视频流PS打包方式详解
  17. 尚硅谷前端视频总结(二)
  18. 阿里云磁盘异常爆满的原因及解决方法
  19. grafana对接zabbix
  20. 互联网人的乐理基础(二)

热门文章

  1. Unity3D Timeline 工作流
  2. Linux的匿名访问Samba
  3. jsp的知识略解,只作为笔记,不作为知识参考,谢谢
  4. 程序转换实验程序流程图_智能化实验室 | # 自动智能化实验室的5大系统 #
  5. 集成ahci驱动的xp系统_IDE转AHCI模式 for win7+SSD
  6. java nmap集成_nmap为了开发方便 可以做简单的修改
  7. 卷积的发展历程,原理和基于 TensorFlow 的实现
  8. VC++动态链接库(DLL)编程深入浅出(四)(转)
  9. Objective-C 继承新的认识以及作用
  10. 创建可扩展性系统-12