简体   繁体   中英

pcl::VoxelGrid<PointXYZ> not working with pcl::PointCloud<PointXYZ>

I'm working with some Laserscans right now and want do downsample the PointClouds in C++. I have an odd issue during building, I think during library linking when I try to compile the Code. Here the minimal Code Snipped where the issue seems to be coming from:

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);

When I try to compile I get the following Error:

undefined reference to `pcl::VoxelGrid<pcl::PointXYZ>::applyFilter(pcl::PointCloud<pcl::PointXYZ>&)'

I found out, that it might be because of missing components in the CMakeList. Here my CMakeList snipped:

find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
cv_bridge
tf
message_generation
)
find_package(OpenCV  REQUIRED)
find_package(PCL 1.7 REQUIRED

If anyone knows, whats wrong, please let me know. I'm using Eclipse, PCL 1.7, ros indigo.

Seems a bit late, but I also ran into this problem. target_link_libraries with -lpcl_filters helped in my case.

什么对我有用:

target_link_libraries(my_project ${catkin_LIBRARIES} ${PCL_LIBRARIES})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM