pcl1.8.0 vs2013 win10 x64 安装配置及部分问题解决方法

主要参考博客:

http://www.zhangzscn.com/2016/03/02/pcl1-8-0%EF%BC%8Cvs2013%E9%85%8D%E7%BD%AE%E6%95%99%E7%A8%8B%E3%80%82/
http://www.cnblogs.com/newpanderking/articles/4022322.html
http://blog.csdn.net/otones/article/details/45138211

感谢作者~


环境:

win 10 x64

visual studio 2013


一、准备工作

首先下载需要的文件,

从第一个参考博客作者给出的百度网盘中下载需要版本的.exe安装程序,属性表,包含pdb文件的压缩包,如图:

http://pan.baidu.com/s/1c1sqoQO

这里以x64为例。


二、安装

1、双击安装包,安装的时候注意选上“Add PCL to the system PATH for all users”,如图所示,这样安装程序会自动在系统环境变量中添加"PCL_ROOT"项

以下具体内容都以我的安装路径为例:


2、安装的过程中会弹出OpenNI的安装程序,将OpenNI的安装路径设置为PCL ROOT下3rdParty\OpenNI2文件夹,例:

E:\Programming_win\PCL\PCL 1.8.0\3rdParty\OpenNI2

(这里可以选择安装在其他目录不过会影响到项目配置)


3、安装程序执行完成后将pdb文件压缩包解压(即 PCL-1.8.0-AllInOne-msvc2013-win64-pdb.rar),pdb文件拷贝到PCL ROOT下的bin文件夹中,例:

E:\Programming_win\PCL\PCL 1.8.0\bin

三、环境变量

上面说过了安装程序会自动添加PCL_ROOT到系统环境变量中,此外还要手动添加PCL、Qhull、FLANN、VTK、OpenNI2的bin目录到PATH中,  

例:

注意如果安装程序没有自动添加PCL_ROOT则需要手动添加(如上图)。


四、项目配置

1、在vs2013中新建项目,

     注意vs2013中Configuration Manager(配置管理器)默认Active solution plantform(活动平台)是Win32,如果安装的是x64的PCL需要将其改成x64,否则编译的时候会出现奇怪的问题。


2、Solution Explorer(解决方案管理器)中右键项目->Properties(属性)

 Configuration Properties(配置管理器)->C/C++->Preprocessor(预处理器)->Preprocessor Definitions(预处理定义) 中添加如下两项:

_SCL_SECURE_NO_WARNINGS
_CRT_SECURE_NO_WARNINGS


3、Property Manager(属性管理器)中,

     Property Manager与Solution Explorer在同一个tab布局中,如果没找到的话,

菜单栏的VIEW(视图)->Other Windows(其他窗口)->Property Manager(属性管理器)


接下来右键每个以Debug或Release开头的文件夹(这里的可能跟我的不一样),Add Existing Property Sheet,选择下载下来的属性表文件(PCLDebug.props或PCLRelease.props),debug就选debug,release就选release。


五、测试代码

直接在工程中添加main.cpp文件后编译运行如下代码,

代码来自博客http://blog.csdn.net/otones/article/details/45138211,感谢博主~

#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>

int user_data;

void viewerOneOff(pcl::visualization::PCLVisualizer& viewer)
{
	viewer.setBackgroundColor(1.0, 0.5, 1.0);
	pcl::PointXYZ o;
	o.x = 1.0;
	o.y = 0;
	o.z = 0;
	viewer.addSphere(o, 0.25, "sphere", 0);
	std::cout << "i only run once" << std::endl;

}

void viewerPsycho(pcl::visualization::PCLVisualizer& viewer)
{
	static unsigned count = 0;
	std::stringstream ss;
	ss << "Once per viewer loop: " << count++;
	viewer.removeShape("text", 0);
	viewer.addText(ss.str(), 200, 300, "text", 0);

	//FIXME: possible race condition here:
	user_data++;
}

int main()
{
	pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
	pcl::io::loadPCDFile("my_point_cloud.pcd", *cloud);

	pcl::visualization::CloudViewer viewer("Cloud Viewer");



	//blocks until the cloud is actually rendered
	viewer.showCloud(cloud);

	//use the following functions to get access to the underlying more advanced/powerful
	//PCLVisualizer

	//This will only get called once
	viewer.runOnVisualizationThreadOnce(viewerOneOff);

	//This will get called once per visualization iteration
	viewer.runOnVisualizationThread(viewerPsycho);
	while (!viewer.wasStopped())
	{
		//you can also do cool processing here
		//FIXME: Note that this is running in a separate thread from viewerPsycho
		//and you should guard against race conditions yourself...
		user_data++;
	}
	return 0;
}

出现如下图所示则说明没有问题,配置成功:


六、小问题

出现类似无法启动此程序,因为计算机中丢失xxx.dll的问题,

首先检查该文件存不存在,若PCL ROOT下没有找到该文件则说明安装出现问题或者链接出现问题(比如卸载重装过PCL但是链接仍指向原有目录)。

若能找到该文件,则返回第三步,仔细检查环境变量的配置,包括配置是否正确及是否有卸载后的残留。



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

补充一下,如果出现下图的状态:


上下划几下鼠标,再滚几下滚轮,就好了。



你可能感兴趣的:(Visual,Studio,PCL)