PCL 和 CMake 的问题:链接时未定义统计异常值删除
Issue with PCL and CMake : StatisticalOutlierRemoval undefined while linking
我目前正在尝试使用 PCL 过滤 pointCloud,这要归功于 StatisticalOutlierRemoval 而不使用 ROS,仅使用 PCL 我通过官方 github 存储库安装。我在代码中使用它,链接时出现以下错误:
CMakeFiles/tests/11_pcl/removeOutliers.dir/removeOutliers.cpp.o: In function `pcl::StatisticalOutlierRemoval<pcl::PointXYZRGB>::applyFilter(std::vector<int, std::allocator<int> >&)':
removeOutliers.cpp:(.text._ZN3pcl25StatisticalOutlierRemovalINS_11PointXYZRGBEE11applyFilterERSt6vectorIiSaIiEE[_ZN3pcl25StatisticalOutlierRemovalINS_11PointXYZRGBEE11applyFilterERSt6vectorIiSaIiEE]+0x1): undefined reference to `pcl::StatisticalOutlierRemoval<pcl::PointXYZRGB>::applyFilterIndices(std::vector<int, std::allocator<int> >&)'
CMakeFiles/tests/11_pcl/removeOutliers.dir/removeOutliers.cpp.o:(.rodata._ZTVN3pcl25StatisticalOutlierRemovalINS_11PointXYZRGBEEE[_ZTVN3pcl25StatisticalOutlierRemovalINS_11PointXYZRGBEEE]+0x48): undefined reference to `pcl::StatisticalOutlierRemoval<pcl::PointXYZRGB>::applyFilter(pcl::PointCloud<pcl::PointXYZRGB>&)'
在我的CMakeList中,我有以下几行:
find_package(PCL 1.3 REQUIRED COMPONENTS common io visualization)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
和:
add_executable(tests/11_pcl/removeOutliers removeOutliers.cpp)
target_link_libraries(tests/11_pcl/removeOutliers ${PCL_LIBRARIES} ${OpenCV_LIBS})
在我的 cpp 文件中,我只尝试使用 :
pcl::StatisticalOutlierRemoval<pcl::PointXYZRGB> sor;
我有以下标题:
#include <pcl/common/common_headers.h>
#include <pcl/features/normal_3d.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/console/parse.h>
//Filters
#include <pcl/point_types.h>
#include <pcl/filters/statistical_outlier_removal.h>
我想我可能在 PCL 中缺少一个组件......知道吗?
好的,我已经找到了解决方案。我实际上缺少PCL(过滤器(中的组件。
find_package(PCL 1.3 REQUIRED COMPONENTS common io visualization filters)
现在一切正常。
相关文章:
- 编译C++时未定义的引用
- vscode g++链路故障:体系结构x86_64的未定义符号
- 如何修复此错误:未定义对"距离(浮点数,浮点数,浮点数,浮点数,浮点数)"的引用
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 不知道某个东西是否被忽略会引入未定义的行为吗
- 对C宏的未定义引用,但在定义它时会出现重新定义错误
- 未定义的引用在哪里
- 编译时的 CImg 库返回对"__imp_SetDIBitsToDevice"的未定义引用
- 对Py_Initialize()的未定义引用
- c++11评估顺序(未定义的行为)
- 使用mysql c++连接器的未定义引用
- 从python调用openMP共享库时,未定义opnMP函数
- 在 Mac 上使用 CMAKE 将 FFTW 和 FFTWPP 链接到项目中时未定义的符号
- Cmake 链接问题:未定义对 Button::mousePressEvent(QGraphicsSceneMouseE
- 未定义的引用 .. 使用 OpenCV 编译 C++ 代码时,从命令行
- 具有外部"c"和程序集的未定义函数
- 此增量后语句是否会导致未定义的行为?
- 尝试调用 .h 文件中定义的变量时出现变量未定义错误
- 是否有一些有意义的统计数据来证明保持有符号整数算术溢出未定义是合理的
- PCL 和 CMake 的问题:链接时未定义统计异常值删除