【win10+pcl181+ vs2017】 常见问题与解决方法

1、vs2017 + win10+ pcl181 参考博文https://www.cnblogs.com/li-yao7758258/p/8066352.html进行的配置,但是编译无法通过。

      解决方法:将vtk和pcl的lib文件名到出到记事本0.txt中,然后全部添加到“输入”依赖列表中。

--------------------------------------------------------------------------

2、vs2017 + win10+ pcl181 VTK编译中出现 no override found for vtkpolydatamapper

     解决方法:参考博文https://blog.csdn.net/kaspar1992/article/details/57080724

--------------------------------------------------------------------------

3、vs2017 + win10+ pcl181 编译时候 出现 std::bad_alloc 错误

     解决方法:添加pcl依赖项不够,添加完整依赖可以跑通程序。

--------------------------------------------------------------------------

4、vs2017 + win10+ pcl181 ,引用#include <pcl/registration/icp.h>时候编译出现下列错误:

     a、d:\pcl181\3rdparty\flann\include\flann\algorithms\dist.h(524): error C3861: “pop_t”: 找不到标识符

     b、id2type_impl 或 pcl181\3rdparty\boost\include\boost-1_64\boost\typeof\msvc\typeof_impl.hpp(125): error C2988: 不可识别的模板声明/定义

     解决办法:对于a问题 需要把dist.h文件中 “typedef unsigned long long pop_t;” 放到#if前面即可(即typedef int ResultType后                                          边),猜测是flann的bug;

                      对于b问题 加#define BOOST_TYPEOF_EMULATION 在 #include <pcl/registration/icp.h> 前即可。

--------------------------------------------------------------------------

5、vs2017 + win10+ pcl181 在 使用 openni2_grabber.h 时,出现pcl181\3rdparty\boost\include\boost-1_64\boost\iostreams\positioning.hpp(96): error C2039: “seekpos”: 不是“std::fpos<_Mbstatet>”的成员

        解决办法:在positioning.hpp 文件中 注释掉 //return pos.seekpos();即可编译通过,亲测可以正常运行。说到根本原因,据           说是vs 2017库问题。

--------------------------------------------------------------------------

6、vs2017 + win10+ pcl181 显示自定义的各类图形,

void viewerOneOff(pcl::visualization::PCLVisualizer& viewer)
{
	//viewer.setBackgroundColor(1.0, 0.5, 1.0);       //设置背景颜色
	
	//add a line
	pcl::PointXYZ p1, p2;
	p1.x = 0; p1.y = 0; p1.z = 0;
	p2.x = 1; p2.y = 1; p2.z = 1;
	viewer.addLine(p1, p2, 0, 1, 0, "line", 0);
	//add a circle
	pcl::ModelCoefficients circle_coeff;
	circle_coeff.values.resize(3);
	circle_coeff.values[0] = 10;
	circle_coeff.values[1] = 10;
	circle_coeff.values[2] = 8;
	viewer.addCircle(circle_coeff, "circle", 0);

	//添加球体
	pcl::PointXYZ o;
	o.x = 1.0;
	o.y = 0;
	o.z = 0;
	viewer.addSphere(o, 0.25, "sphere", 0);
	//addSphere (const PointT &center, double radius, const std::string &id, int viewport)

	//添加立方体
	viewer.addCube(0, 0.1, 0, 0.1, 0, 0.1, 1, 0, 0, "cube", 0);
	//addCube(float x_min, float x_max, float y_min, float y_max, float z_min, float z_max,
	//double r = 1.0, double g = 1.0, double b = 1.0, const std::string &id = "cube", int viewport = 0);

	//添加圆锥
	pcl::ModelCoefficients cone;
	cone.values.push_back(0);
	cone.values.push_back(0);
	cone.values.push_back(0);
	cone.values.push_back(0.0);
	cone.values.push_back(1.0);
	cone.values.push_back(0.0);
	cone.values.push_back(5.0);
	viewer.addCone(cone, "cone");

	//viewer.removeAllPointClouds();//删除所有点	

	//添加箭头
	pcl::PointXYZ A, B;
	A.x = 0; A.y = 0; A.z = 0;
	B.x = -1; B.y = 0; B.z = 0;
	viewer.addArrow<pcl::PointXYZ>(A, B, 255, 0, 0, false, "arrow", 0);

	//viewer.removeAllShapes();移除形状
	
	std::cout << "i only run once" << std::endl;

}

在显示球体 和 箭头 时候,运行时候报错“引发的异常: 0xC0000005: 读取位置 0x00000000 时发生访问冲突。” 其它图形可以正常显示。

       解决办法:引用依赖项增加 opengl32.lib。同时在代码顶部添加以下代码:

#include <vtkAutoInit.h>       
VTK_MODULE_INIT(vtkRenderingOpenGL);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);

--------------------------------------------------------------------------

6、引用 “#include <pcl/octree/octree.h>  ” 时候,编译报错:pcl181\3rdparty\boost\include\boost-1_64\boost\typeof\msvc\typeof_impl.hpp(125): error C2988: 不可识别的模板声明/定义

       解决办法:添加 #define BOOST_TYPEOF_EMULATION

--------------------------------------------------------------------------

 

7、编译错误“Error C4996 'pcl::SAC_SAMPLE_SIZE': This map is deprecated and is kept only to prevent breaking existing user code. Starting from PCL 1.8.0 model sample size is a protected member of the SampleConsensusModel class ”

解决方法:Hey I manage to "solve" the problem. I really don't think I solved just found a way to go over it. I just commented this part in the file model_types.h: 
 

namespace pcl 
{ 
  const static std::map<pcl::SacModel, unsigned int>
 // PCL_DEPRECATED("This map is deprecated and is kept only to prevent breaking " 
 //                "existing user code. Starting from PCL 1.8.0 model sample size " 
 //                "is a protected member of the SampleConsensusModel class") 
  SAC_SAMPLE_SIZE (sample_size_pairs, sample_size_pairs + sizeof (sample_size_pairs) / sizeof (SampleSizeModel)); 
} 

注释掉后不影响程序编译和运行。

 

 

=========to be continue.=======

 

  • 7
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值