Linking errors PCL
Hi,
I am trying to implement something like this: https://pcl.readthedocs.io/en/latest/... using lidar output.
I'm getting linking errors when trying to compile this.
colcon build --symlink-install
Starting >>> cpp_tests
--- stderr: cpp_tests
** WARNING ** io features related to pcap will be disabled
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o: in function `pcl::Registration<pcl::PointXYZ, pcl::PointXYZ, float>::align(pcl::PointCloud<pcl::PointXYZ>&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&)':
ndt_transform_calculator.cpp:(.text._ZN3pcl12RegistrationINS_8PointXYZES1_fE5alignERNS_10PointCloudIS1_EERKN5Eigen6MatrixIfLi4ELi4ELi0ELi4ELi4EEE[_ZN3pcl12RegistrationINS_8PointXYZES1_fE5alignERNS_10PointCloudIS1_EERKN5Eigen6MatrixIfLi4ELi4ELi0ELi4ELi4EEE]+0x242): undefined reference to `pcl::search::KdTree<pcl::PointXYZ, pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > >::setPointRepresentation(std::shared_ptr<pcl::PointRepresentation<pcl::PointXYZ> const> const&)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o: in function `pcl::Registration<pcl::PointXYZ, pcl::PointXYZ, float>::Registration()':
ndt_transform_calculator.cpp:(.text._ZN3pcl12RegistrationINS_8PointXYZES1_fEC2Ev[_ZN3pcl12RegistrationINS_8PointXYZES1_fEC5Ev]+0x69): undefined reference to `pcl::search::KdTree<pcl::PointXYZ, pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > >::KdTree(bool)'
/usr/bin/ld: ndt_transform_calculator.cpp:(.text._ZN3pcl12RegistrationINS_8PointXYZES1_fEC2Ev[_ZN3pcl12RegistrationINS_8PointXYZES1_fEC5Ev]+0x98): undefined reference to `pcl::search::KdTree<pcl::PointXYZ, pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > >::KdTree(bool)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o: in function `pcl::VoxelGridCovariance<pcl::PointXYZ>::VoxelGridCovariance()':
ndt_transform_calculator.cpp:(.text._ZN3pcl19VoxelGridCovarianceINS_8PointXYZEEC2Ev[_ZN3pcl19VoxelGridCovarianceINS_8PointXYZEEC5Ev]+0xe7): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::KdTreeFLANN(bool)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o: in function `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::~KdTreeFLANN()':
ndt_transform_calculator.cpp:(.text._ZN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEED2Ev[_ZN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEED5Ev]+0x26): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::cleanup()'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o: in function `pcl::VoxelGridCovariance<pcl::PointXYZ>::filter(bool)':
ndt_transform_calculator.cpp:(.text._ZN3pcl19VoxelGridCovarianceINS_8PointXYZEE6filterEb[_ZN3pcl19VoxelGridCovarianceINS_8PointXYZEE6filterEb]+0x135): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o:(.data.rel.ro._ZTVN3pcl19VoxelGridCovarianceINS_8PointXYZEEE[_ZTVN3pcl19VoxelGridCovarianceINS_8PointXYZEEE]+0x48): undefined reference to `pcl::VoxelGridCovariance<pcl::PointXYZ>::applyFilter(pcl::PointCloud<pcl::PointXYZ>&)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o:(.data.rel.ro._ZTVN3pcl9VoxelGridINS_8PointXYZEEE[_ZTVN3pcl9VoxelGridINS_8PointXYZEEE]+0x48): undefined reference to `pcl::VoxelGrid<pcl::PointXYZ>::applyFilter(pcl::PointCloud<pcl::PointXYZ>&)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o:(.data.rel.ro._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[_ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE]+0x10): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(std::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, std::shared_ptr<std::vector<int, std::allocator<int> > const> const&)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o:(.data.rel.ro._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[_ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE]+0x28): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::nearestKSearch(pcl::PointXYZ const&, unsigned int, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&) const'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o:(.data.rel.ro._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[_ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE]+0x40): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::radiusSearch(pcl::PointXYZ const&, double, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&, unsigned int) const'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o:(.data.rel.ro._ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE[_ZTVN3pcl11KdTreeFLANNINS_8PointXYZEN5flann9L2_SimpleIfEEEE]+0x58): undefined reference to `pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setEpsilon(float)'
/usr/bin/ld: CMakeFiles/ndt_test.dir/src/ndt_transform_calculator.cpp.o: in function `pcl ...
@ALNA_Perera Glad you resolved by yourself and thanks for sharing your resolution by updating your post.. Would you mind posting that as an answer, then mark it as "Answer" so that others can tell the question is resolved, and easily find the answer?
I will do that. I'm still not sure why that worked though.