我现在正在做一些激光扫描,并希望在C++下采样的PointClouds。我在构建过程中遇到了一个奇怪的问题,当我尝试编译代码时,我认为是在库链接期间。这里最小的代码截取了问题的来源:
pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_last (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr downsampled (new pcl::PointCloud<pcl::PointXYZ>);
point_cloud_last = _last_pt_cl.makeShared();
pcl::VoxelGrid<pcl::PointXYZ> sor;
sor.setInputCloud (point_cloud_last);
sor.setLeafSize (0.05f, 0.05f, 0.05f);
sor.filter (*downsampled);当我尝试编译时,我得到了以下错误:
undefined reference to `pcl::VoxelGrid<pcl::PointXYZ>::applyFilter(pcl::PointCloud<pcl::PointXYZ>&)'我发现,这可能是因为CMakeList中缺少组件。下面是我的CMakeList截图:
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
cv_bridge
tf
message_generation
)
find_package(OpenCV REQUIRED)
find_package(PCL 1.7 REQUIRED如果有人知道出了什么问题,请让我知道。我使用的是Eclipse,PCL1.7,ros indigo。
发布于 2018-03-02 04:29:53
看起来有点晚,但我也遇到了这个问题。在我的案例中,target_link_libraries和-lpcl_filters起到了帮助作用。
发布于 2019-08-03 04:15:09
对我有效的方法:
target_link_libraries(my_project ${catkin_LIBRARIES} ${PCL_LIBRARIES})https://stackoverflow.com/questions/48292715
复制相似问题