报错信息

做PCL时报错如下:

PCL报错:0x00007FFCA6FC5549 处(位于 XXX.exe 中)有未经处理的异常: Microsoft C++ 异常: pcl::IOException_PCL

错误产生的位置为:

PCL报错:0x00007FFCA6FC5549 处(位于 XXX.exe 中)有未经处理的异常: Microsoft C++ 异常: pcl::IOException_IOException_02

错误原因

registerCallback的参数function定义时候的参数必须是constPtr。

解决方案

注意我们的参数function。

在定义位置有下面两种定义方式:

boost::function<void(const pcl::PointCloud<PointType>::ConstPtr&)> function = [&pointCloud_XYZRGBA, &mutex](const pcl::PointCloud<PointType>::ConstPtr& ptr) {
boost::mutex::scoped_lock lock(mutex);
/* Point Cloud Processing */
pointCloud_XYZRGBA = ptr->makeShared();
//ptr->makeShared() = NULL;
};
boost::function<void(const pcl::PointCloud<PointType>::Ptr&)> function = [&pointCloud_XYZRGBA, &mutex](const pcl::PointCloud<PointType>::Ptr& ptr) {
boost::mutex::scoped_lock lock(mutex);
/* Point Cloud Processing */
pointCloud_XYZRGBA = ptr->makeShared();
//ptr->makeShared() = NULL;
};

第一种方式不会出错。