vickyTwan 2023-02-16 09:32 采纳率: 60%
浏览 17
已结题

ros点云地面分割代码报错,如何解决?(语言-c++|操作系统-ubuntu)

跑adam博主的点云地面分割代码 功能包编译最后一步总是跳这个错误是为什么?https://adamshan.blog.csdn.net/article/details/82901295
[100%] Linking CXX executable /home/vickytwan/pcl_ws/devel/lib/pcl_test/pcl_test_node
/usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o: in function PclTestCore::point_cb(boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&)': pcl_test_core.cpp:(.text+0x416): undefined reference to pcl::PCLBasepcl::PointXYZI::setInputCloud(std::shared_ptr<pcl::PointCloudpcl::PointXYZI const> const&)'
/usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_9PointXYZIEEE[_ZTVN3pcl9VoxelGridINS_9PointXYZIEEE]+0x20): undefined reference to pcl::PCLBase<pcl::PointXYZI>::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const> const&)' /usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_9PointXYZIEEE[_ZTVN3pcl9VoxelGridINS_9PointXYZIEEE]+0x28): undefined reference to pcl::PCLBasepcl::PointXYZI::setIndices(std::shared_ptr<std::vector<int, std::allocator > > const&)'
/usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_9PointXYZIEEE[_ZTVN3pcl9VoxelGridINS_9PointXYZIEEE]+0x30): undefined reference to pcl::PCLBase<pcl::PointXYZI>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)' /usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_9PointXYZIEEE[_ZTVN3pcl9VoxelGridINS_9PointXYZIEEE]+0x38): undefined reference to pcl::PCLBasepcl::PointXYZI::setIndices(std::shared_ptr<pcl::PointIndices const> const&)'
/usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_9PointXYZIEEE[_ZTVN3pcl6FilterINS_9PointXYZIEEE]+0x20): undefined reference to pcl::PCLBase<pcl::PointXYZI>::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const> const&)' /usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_9PointXYZIEEE[_ZTVN3pcl6FilterINS_9PointXYZIEEE]+0x28): undefined reference to pcl::PCLBasepcl::PointXYZI::setIndices(std::shared_ptr<std::vector<int, std::allocator > > const&)'
/usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_9PointXYZIEEE[_ZTVN3pcl6FilterINS_9PointXYZIEEE]+0x30): undefined reference to pcl::PCLBase<pcl::PointXYZI>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)' /usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl6FilterINS_9PointXYZIEEE[_ZTVN3pcl6FilterINS_9PointXYZIEEE]+0x38): undefined reference to pcl::PCLBasepcl::PointXYZI::setIndices(std::shared_ptr<pcl::PointIndices const> const&)'
/usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_9PointXYZIEEE[_ZTVN3pcl7PCLBaseINS_9PointXYZIEEE]+0x20): undefined reference to pcl::PCLBase<pcl::PointXYZI>::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZI> const> const&)' /usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_9PointXYZIEEE[_ZTVN3pcl7PCLBaseINS_9PointXYZIEEE]+0x28): undefined reference to pcl::PCLBasepcl::PointXYZI::setIndices(std::shared_ptr<std::vector<int, std::allocator > > const&)'
/usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_9PointXYZIEEE[_ZTVN3pcl7PCLBaseINS_9PointXYZIEEE]+0x30): undefined reference to pcl::PCLBase<pcl::PointXYZI>::setIndices(std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)' /usr/bin/ld: CMakeFiles/pcl_test_node.dir/src/pcl_test_core.cpp.o:(.data.rel.ro._ZTVN3pcl7PCLBaseINS_9PointXYZIEEE[_ZTVN3pcl7PCLBaseINS_9PointXYZIEEE]+0x38): undefined reference to pcl::PCLBasepcl::PointXYZI::setIndices(std::shared_ptr<pcl::PointIndices const> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [pcl_test/CMakeFiles/pcl_test_node.dir/build.make:215:/home/vickytwan/pcl_ws/devel/lib/pcl_test/pcl_test_node] 错误 1
make[1]: *** [CMakeFiles/Makefile2:482:pcl_test/CMakeFiles/pcl_test_node.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2
Invoking "make -j2 -l2" failed

  • 写回答

2条回答 默认 最新

  • 量化研究所 2023-02-16 09:36
    关注

    这个错误是由于链接错误导致的。当您尝试构建一个程序时,编译器将从多个源文件中提取目标代码并将其链接在一起以创建最终的可执行文件。这个错误发生在链接时,因为编译器找不到所需的目标代码。

    在您的情况下,错误消息指出了一些在链接时找不到的符号,这些符号似乎与PCL库的一些方法有关。可能是您忘记链接某个库,或者库路径不正确,或者库版本不正确。您可以按照以下步骤尝试解决此问题:

    确保已经正确地安装了 PCL 库,包括开发文件(包括头文件和库文件)。
    确认在 CMakeLists.txt 文件中,已经正确地设置了 PCL 库的路径和包含路径,并在 target_link_libraries()函数中包含所需的库。
    检查您的代码,确保您正确地包含了必需的头文件,并在代码中正确地使用了PCL库中的方法。
    如果您仍然无法解决问题,请提供更多细节和您的代码。
    望采纳。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 2月24日
  • 已采纳回答 2月16日
  • 创建了问题 2月16日

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效