C++ pcl欧氏聚类提取中的链接错误
在尝试运行pcl提供的示例时,我遇到了最奇怪的链接错误: 我已将错误缩小到以下行:C++ pcl欧氏聚类提取中的链接错误,c++,static-linking,point-cloud-library,C++,Static Linking,Point Cloud Library,在尝试运行pcl提供的示例时,我遇到了最奇怪的链接错误: 我已将错误缩小到以下行: ec.extract (cluster_indices); 当我删除这一行时,没有链接错误,否则我会得到一堆如下所示: /usr/local/lib/libpcl_search.a(organized.cpp.o): In function `pcl::search::OrganizedNeighbor<pcl::PointXYZL>::computeCameraMatrix(Eigen::Matr
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>&)'
_ZNK3pcl6search17OrganizedNeighborINS_11PointNormalEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE
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})
哪些接近所需的include函数,但似乎PointXYZ实现不存在?我怎样才能知道情况是否如此以及原因呢?看来cmake正在与依赖性作斗争。我确信这是因为我们被迫将pcl包括在内。我们正在使用一个名为QNX的操作系统,这意味着CMakeLists.txt需要如下所示:
/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>&)'
_ZNK3pcl6search17OrganizedNeighborINS_11PointNormalEE19computeCameraMatrixERN5Eigen6MatrixIfLi3ELi3ELi0ELi3ELi3EEE
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规则