PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7

逛各种各样的网站中的博客也有好长时间了,从他人无私的分享中也学到许多知识,解决当下问题的同时也少走了许多弯路。自己也早早的注册了CSDN的账号,但总是感觉积累不够,迟迟未能迈出第一步。今天在安装调试成功PCL环境后,突然发觉该记录点什么,也不一定需要方方面面都考虑周全。记录下自己安装过程中的问题及解决方法,既是想和后来者分享自己的一点经验,也是捋一捋思路的好方法。

PCL1.8.1及VS2017安装包下载

VS2017我下载的是community版本,这个版本是不需要激活就能使用的,直接在官网上下载对应的最新版本就好,官网下载地址:

Visual Studio 2017 Community 版本

PCL库是一款非常棒的3D图像处理相关的开源库,地位相当于2D中的OpenCV。刚开始我是直接在官网上下载的PCL1.6版本,一次查询相关资料的偶然机会,我发现还有更高版本的PCL库一直在更新,只是转移到了github上,以及开源作者(推测)的博客上。各版本链接如下,官网上Documentation的各个模块的功能及原理讲的非常好,建议大家可以看看。

PCL官网
作者Blog及PCL1.8.1版本下载地址
PCL库Github地址

VS2017软件安装

vs2017的安装比较简单,这里建议大家如果后续会长时间撸代码之类的话,选择默认安装目录,这样后续其他软件支持时,会减少出各种Bug的几率,同时运行也快些。还有为了更好的支持CMake软件,在组件选择的时候,Windows开发和Visual C++的相关组件都需要安装,其他的看自己的需求。

PCL1.8.1安装

这里我下载的是PCL1.8.1 All-In-One版本,只需要默认安装便可,其中OpenNI2.0需要安装在PCL目录下的3rdParty目录下的OpenNI2目录下,便于程序寻找调用。另一个需要注意的是可以选择不添加系统变量,后面手动添加(我安装是选择自动添加会报错)
PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7_第1张图片
安装完成后在计算机——属性——高级系统设置——环境变量——系统变量中添加环境变量,PCL_ROOT和OpenNI需要新建,另外需要在Path中添加C:\Program Files\PCL 1.8.1\bin;%PCL_ROOT%\bin;%OPENNI2_REDIST%;及第三方库bin文件夹路径(根据安装位置更改)
PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7_第2张图片

环境试运行

安装好相应的软件后进行VS2017编译环境设置,创建新的控制台程序,在新建的CPP文件中输入测试代码:

#include  
#include   
#include   
#include   
#include   

int main(int argc, char** argv)
{
	pcl::PointCloud::Ptr cloud(new pcl::PointCloud);
	pcl::PointCloud::Ptr cloud_projected(new pcl::PointCloud);

	// Fill in the cloud data  
	cloud->width = 5;
	cloud->height = 1;
	cloud->points.resize(cloud->width * cloud->height);

	for (size_t i = 0; i < cloud->points.size(); ++i)
	{
		cloud->points[i].x = 1024 * rand() / (RAND_MAX + 1.0f);
		cloud->points[i].y = 1024 * rand() / (RAND_MAX + 1.0f);
		cloud->points[i].z = 1024 * rand() / (RAND_MAX + 1.0f);
	}

	std::cerr << "Cloud before projection: " << std::endl;
	for (size_t i = 0; i < cloud->points.size(); ++i)
		std::cerr << "    " << cloud->points[i].x << " "
		<< cloud->points[i].y << " "
		<< cloud->points[i].z << std::endl;

	// Create a set of planar coefficients with X=Y=0,Z=1  
	pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients());
	coefficients->values.resize(4);
	coefficients->values[0] = coefficients->values[1] = 0;
	coefficients->values[2] = 1.0;
	coefficients->values[3] = 0;

	// Create the filtering object  
	pcl::ProjectInliers proj;
	proj.setModelType(pcl::SACMODEL_PLANE);
	proj.setInputCloud(cloud);
	proj.setModelCoefficients(coefficients);
	proj.filter(*cloud_projected);

	std::cerr << "Cloud after projection: " << std::endl;
	for (size_t i = 0; i < cloud_projected->points.size(); ++i)
		std::cerr << "    " << cloud_projected->points[i].x << " "
		<< cloud_projected->points[i].y << " "
		<< cloud_projected->points[i].z << std::endl;

	system("pause");
	return (0);
}

测试之前需要先配置属性,这里可以直接导入我的配置文件,但可能由于安装路径和软件版本出错。出错则根据错误提示按照后续相应步骤进行修改。
配置文件下载:
PCL1.8.1配置文件
首先在属性管理器中新建项目属性表:
PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7_第3张图片
双击打开新建的项目属性表后选择VC++目录选项,然后选中包含目录选项,点击右方的按钮,选择编辑:
PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7_第4张图片
在其中添加PCL头文件目录及第三方头文件目录,注意有些目录不需要到最后一层:
PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7_第5张图片
确定后选择库目录,同样将安装目录下的相关库文件目录添加进去:
PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7_第6张图片
然后选择属性页中的链接器(左边)中的输入,在附加依赖项中添加所有需要的.lib文件:
PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7_第7张图片
libboost_atomic-vc141-mt-gd-1_64.lib
libboost_bzip2-vc141-mt-gd-1_64.lib
libboost_chrono-vc141-mt-gd-1_64.lib
libboost_container-vc141-mt-gd-1_64.lib
libboost_context-vc141-mt-gd-1_64.lib
libboost_coroutine-vc141-mt-gd-1_64.lib
libboost_date_time-vc141-mt-gd-1_64.lib
libboost_exception-vc141-mt-gd-1_64.lib
libboost_fiber-vc141-mt-gd-1_64.lib
libboost_filesystem-vc141-mt-gd-1_64.lib
libboost_graph_parallel-vc141-mt-gd-1_64.lib
libboost_graph-vc141-mt-gd-1_64.lib
libboost_iostreams-vc141-mt-gd-1_64.lib
libboost_locale-vc141-mt-gd-1_64.lib
libboost_log-vc141-mt-gd-1_64.lib
libboost_log_setup-vc141-mt-gd-1_64.lib
libboost_math_c99-vc141-mt-gd-1_64.lib
libboost_math_c99f-vc141-mt-gd-1_64.lib
libboost_math_c99l-vc141-mt-gd-1_64.lib
libboost_math_tr1-vc141-mt-gd-1_64.lib
libboost_math_tr1f-vc141-mt-gd-1_64.lib
libboost_math_tr1l-vc141-mt-gd-1_64.lib
libboost_mpi-vc141-mt-gd-1_64.lib
libboost_numpy3-vc141-mt-gd-1_64.lib
libboost_numpy-vc141-mt-gd-1_64.lib
libboost_prg_exec_monitor-vc141-mt-gd-1_64.lib
libboost_program_options-vc141-mt-gd-1_64.lib
libboost_python3-vc141-mt-gd-1_64.lib
libboost_python-vc141-mt-gd-1_64.lib
libboost_random-vc141-mt-gd-1_64.lib
libboost_regex-vc141-mt-gd-1_64.lib
libboost_serialization-vc141-mt-gd-1_64.lib
libboost_signals-vc141-mt-gd-1_64.lib
libboost_system-vc141-mt-gd-1_64.lib
libboost_test_exec_monitor-vc141-mt-gd-1_64.lib
libboost_thread-vc141-mt-gd-1_64.lib
libboost_timer-vc141-mt-gd-1_64.lib
libboost_type_erasure-vc141-mt-gd-1_64.lib
libboost_unit_test_framework-vc141-mt-gd-1_64.lib
libboost_wave-vc141-mt-gd-1_64.lib
libboost_wserialization-vc141-mt-gd-1_64.lib
libboost_zlib-vc141-mt-gd-1_64.lib

pcl_common_debug.lib
pcl_features_debug.lib
pcl_filters_debug.lib
pcl_io_debug.lib
pcl_io_ply_debug.lib
pcl_kdtree_debug.lib
pcl_keypoints_debug.lib
pcl_ml_debug.lib
pcl_octree_debug.lib
pcl_outofcore_debug.lib
pcl_people_debug.lib
pcl_recognition_debug.lib
pcl_registration_debug.lib
pcl_sample_consensus_debug.lib
pcl_search_debug.lib
pcl_segmentation_debug.lib
pcl_stereo_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
libboost_atomic-vc141-mt-gd-1_64.lib
libboost_bzip2-vc141-mt-gd-1_64.lib
libboost_chrono-vc141-mt-gd-1_64.lib
libboost_container-vc141-mt-gd-1_64.lib
libboost_context-vc141-mt-gd-1_64.lib
libboost_coroutine-vc141-mt-gd-1_64.lib
libboost_date_time-vc141-mt-gd-1_64.lib
libboost_exception-vc141-mt-gd-1_64.lib
libboost_fiber-vc141-mt-gd-1_64.lib
libboost_filesystem-vc141-mt-gd-1_64.lib
libboost_graph_parallel-vc141-mt-gd-1_64.lib
libboost_graph-vc141-mt-gd-1_64.lib
libboost_iostreams-vc141-mt-gd-1_64.lib
libboost_locale-vc141-mt-gd-1_64.lib
libboost_log-vc141-mt-gd-1_64.lib
libboost_log_setup-vc141-mt-gd-1_64.lib
libboost_math_c99-vc141-mt-gd-1_64.lib
libboost_math_c99f-vc141-mt-gd-1_64.lib
libboost_math_c99l-vc141-mt-gd-1_64.lib
libboost_math_tr1-vc141-mt-gd-1_64.lib
libboost_math_tr1f-vc141-mt-gd-1_64.lib
libboost_math_tr1l-vc141-mt-gd-1_64.lib
libboost_mpi-vc141-mt-gd-1_64.lib
libboost_numpy3-vc141-mt-gd-1_64.lib
libboost_numpy-vc141-mt-gd-1_64.lib
libboost_prg_exec_monitor-vc141-mt-gd-1_64.lib
libboost_program_options-vc141-mt-gd-1_64.lib
libboost_python3-vc141-mt-gd-1_64.lib
libboost_python-vc141-mt-gd-1_64.lib
libboost_random-vc141-mt-gd-1_64.lib
libboost_regex-vc141-mt-gd-1_64.lib
libboost_serialization-vc141-mt-gd-1_64.lib
libboost_signals-vc141-mt-gd-1_64.lib
libboost_system-vc141-mt-gd-1_64.lib
libboost_test_exec_monitor-vc141-mt-gd-1_64.lib
libboost_thread-vc141-mt-gd-1_64.lib
libboost_timer-vc141-mt-gd-1_64.lib
libboost_type_erasure-vc141-mt-gd-1_64.lib
libboost_unit_test_framework-vc141-mt-gd-1_64.lib
libboost_wave-vc141-mt-gd-1_64.lib
libboost_wserialization-vc141-mt-gd-1_64.lib
libboost_zlib-vc141-mt-gd-1_64.lib
vtkzlib-8.0-gd.lib
vtkViewsContext2D-8.0-gd.lib
vtkhdf5_hl-8.0-gd.lib
vtkFiltersProgrammable-8.0-gd.lib
vtkIOMovie-8.0-gd.lib
vtkexpat-8.0-gd.lib
vtkRenderingLOD-8.0-gd.lib
vtkIOPLY-8.0-gd.lib
vtkpng-8.0-gd.lib
vtkIOVideo-8.0-gd.lib
vtkRenderingImage-8.0-gd.lib
vtkFiltersVerdict-8.0-gd.lib
vtkjpeg-8.0-gd.lib
vtkInteractionImage-8.0-gd.lib
vtkverdict-8.0-gd.lib
vtkoggtheora-8.0-gd.lib
vtkImagingStatistics-8.0-gd.lib
vtkCommonSystem-8.0-gd.lib
vtkFiltersParallelImaging-8.0-gd.lib
vtkFiltersTexture-8.0-gd.lib
vtkCommonMisc-8.0-gd.lib
vtkCommonMath-8.0-gd.lib
vtkFiltersSelection-8.0-gd.lib
vtkImagingFourier-8.0-gd.lib
vtkIOXMLParser-8.0-gd.lib
vtkproj4-8.0-gd.lib
vtkalglib-8.0-gd.lib
vtktiff-8.0-gd.lib
vtksqlite-8.0-gd.lib
vtkImagingSources-8.0-gd.lib
vtkCommonTransforms-8.0-gd.lib
vtkImagingMath-8.0-gd.lib
vtkFiltersGeneric-8.0-gd.lib
vtkexoIIc-8.0-gd.lib
vtkfreetype-8.0-gd.lib
vtkImagingColor-8.0-gd.lib
vtknetcdf_c+±gd.lib
vtkNetCDF-8.0-gd.lib
vtkFiltersImaging-8.0-gd.lib
vtkFiltersHyperTree-8.0-gd.lib
vtkImagingMorphological-8.0-gd.lib
vtkImagingStencil-8.0-gd.lib
vtkRenderingFreeType-8.0-gd.lib
vtkCommonColor-8.0-gd.lib
vtkjsoncpp-8.0-gd.lib
vtkRenderingContext2D-8.0-gd.lib
vtkFiltersAMR-8.0-gd.lib
vtkRenderingContextOpenGL-8.0-gd.lib
vtkIOParallelXML-8.0-gd.lib
vtkViewsCore-8.0-gd.lib
vtkImagingHybrid-8.0-gd.lib
vtkIOExport-8.0-gd.lib
vtkRenderingVolumeOpenGL-8.0-gd.lib
vtkIOImport-8.0-gd.lib
vtkDomainsChemistry-8.0-gd.lib
vtkInteractionStyle-8.0-gd.lib
vtkCommonComputationalGeometry-8.0-gd.lib
vtkDICOMParser-8.0-gd.lib
vtklibxml2-8.0-gd.lib
vtkIOMINC-8.0-gd.lib
vtkIOSQL-8.0-gd.lib
vtkFiltersModeling-8.0-gd.lib
vtkParallelCore-8.0-gd.lib
vtkIOAMR-8.0-gd.lib
vtkGeovisCore-8.0-gd.lib
vtksys-8.0-gd.lib
vtkIOEnSight-8.0-gd.lib
vtkImagingGeneral-8.0-gd.lib
vtkFiltersFlowPaths-8.0-gd.lib
vtkIOLSDyna-8.0-gd.lib
vtkFiltersSMP-8.0-gd.lib
vtkIOParallel-8.0-gd.lib
vtkFiltersGeometry-8.0-gd.lib
vtkInfovisLayout-8.0-gd.lib
vtkIOCore-8.0-gd.lib
vtkFiltersSources-8.0-gd.lib
vtkIOLegacy-8.0-gd.lib
vtkFiltersHybrid-8.0-gd.lib
vtkIONetCDF-8.0-gd.lib
vtkFiltersExtraction-8.0-gd.lib
vtkFiltersParallel-8.0-gd.lib
vtkRenderingLabel-8.0-gd.lib
vtkIOInfovis-8.0-gd.lib
vtkRenderingAnnotation-8.0-gd.lib
vtkImagingCore-8.0-gd.lib
vtkCommonExecutionModel-8.0-gd.lib
vtkhdf5-8.0-gd.lib
vtkViewsInfovis-8.0-gd.lib
vtkIOGeometry-8.0-gd.lib
vtkmetaio-8.0-gd.lib
vtkIOImage-8.0-gd.lib
vtkIOXML-8.0-gd.lib
vtkIOExodus-8.0-gd.lib
vtkRenderingVolume-8.0-gd.lib
vtkChartsCore-8.0-gd.lib
vtkFiltersStatistics-8.0-gd.lib
vtkInfovisCore-8.0-gd.lib
vtkRenderingCore-8.0-gd.lib
vtkInteractionWidgets-8.0-gd.lib
vtkRenderingOpenGL-8.0-gd.lib
vtkFiltersGeneral-8.0-gd.lib
vtkFiltersCore-8.0-gd.lib
vtkCommonDataModel-8.0-gd.lib
vtkCommonCore-8.0-gd.lib
flann_cpp_s-gd.lib
qhullstatic_d.lib
OpenNI2.lib
这里可能需要根据实际安装后.lib文件名进行相应的修改;
最后点击应用,完成属性设置。

属性设置后我所遇到的bug:

C4996错误

编译BOOST库出现std::fpos<_Mbstatet>::seekpos’: warning STL4019: The member std::fpos::seekpos() is non-Standard, and is preserved only for compatibility with workarounds for old versions of Visual C++. It will be removed in a future release…

参考博客:boost库编译出错C4996

找不到PCL_COMMON_DEBUG.DLL

最开始安装完PCL库之后,系统环境变量没有设置到位,需要添加PCL库自身的bin文件夹路径:

参考博客:PCL库环境变量配置

找不到openni2.dll

参考博客:.dll文件配置

PCL1.9.0版本参考博客PCL1.9.0

你可能感兴趣的:(PCL1.8.1+VS2017+win7 安装环境杂记 19.5.7)