pcl EuclideanClusterExtraction中的链接错误
Linking error in pcl EuclideanClusterExtraction
当尝试运行pcl提供的示例时,我遇到了最奇怪的链接错误:
http://www.pointclouds.org/documentation/tutorials/cluster_extraction.php我已经把错误缩小到以下一行:
ec.extract (cluster_indices);
当我删除这一行时,没有链接错误,否则我得到一堆看起来像这样的:
/usr/local/lib/libpcl_search.a(organized.cpp.o): In function `pcl::search::OrganizedNeighbor<pcl::PointXYZL>::computeCameraMatrix(Eigen::Matrix<float, 3, 3, 0, 3, 3>&) const':
organized.cpp:(.text._ZNK3pcl6search17OrganizedNeighborINS_9PointXYZLEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE
[_ZNK3pcl6search17OrganizedNeighborINS_9PointXYZLEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE]+0xc):
undefined reference to `pcl::getCameraMatrixFromProjectionMatrix(Eigen::Matrix<float, 3, 4, 1, 3, 4> const&, Eigen::Matrix<float, 3, 3, 0, 3, 3>&)'
ec
为pcl::EuclideanClusterExtraction<pcl::PointXYZ>
类型,所有相关联的点云也均采用pcl::PointXYZ
模板。
我之前有一个非常类似的错误,事实证明是因为我试图使用pcl::PointXY
与不支持的SampleConsesus
库。
为了尝试解决这个问题,我在libpcl_search.a
链接库上使用了nm
,包含的值看起来像这样:
_ZNK3pcl6search17OrganizedNeighborINS_11PointNormalEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE
接近所需的包含函数,但似乎PointXYZ
实现不存在?我怎样才能知道情况是否如此?为什么?
所以看起来cmake正在与依赖关系作斗争。我确信这是因为我们被迫加入pcl的方式。我们正在使用一个名为QNX
的操作系统,这意味着CMakeLists.txt
需要看起来像这样:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set (CMAKE_C_COMPILER /usr/qnx650/host/qnx6/x86/usr/bin/gcc)
set (CMAKE_CXX_COMPILER /usr/qnx650/host/qnx6/x86/usr/bin/g++)
project(cluster_extraction)
find_package(PCL 1.7 REQUIRED)
include_directories(/usr/local/include /usr/local/include/pcl-1.7)
link_directories(/usr/local/lib)
add_definitions(${PCL_DEFINITIONS})
add_executable (cluster_extraction testEuclideanclustering.cpp)
target_link_libraries (cluster_extraction ${PCL_LIBRARIES})
如果我在${PCL_LIBRARIES}
的链接之后添加pcl_search
的直接链接,那么它将编译。看来我们需要为pcl
制定自己的cmake
规则。
相关文章:
- 静态数据成员的问题-修复链接错误会导致编译器错误
- Visual Studio mkl_link_tool.exe链接错误
- C++ 实现模板单例类时出现链接错误
- 使用类模板的方法链接错误
- MySQL C++连接器链接错误
- VS 2015 链接错误 无法构建依赖于 libcurl 的项目
- 运行 C++ 单元测试时LNK2005链接错误
- 对 CMake 中'cudaRegisterLinkedBinary'链接错误的未定义引用?
- 链接错误,包括我创建的相同头文件 - C++
- 在Embarcadero C++ Builder中生成的DLL未解决的外部链接错误
- 使用标头保护的多个定义链接错误
- 链接错误:未定义对 stdscr 和 wgetch 的引用
- 使用 Vivek 的 Vcam / 捕获源过滤器构建/链接错误
- 升压program_options中的链接错误
- 使用 g++ 预处理器进行替换会导致链接错误
- 在调试配置中编译工作正常,但发布会给出链接错误
- 相邻矩阵设置链接错误
- 包含常量变量并包含在多个文件中的标头的链接错误
- C++链接错误,我理解但无法解决
- 是什么导致macOS Mojave上的GoogleTest链接错误