VS2019+pcl1.12.1配置详解
简述一下在配置pcl1.12.1搭配vs2019过程中遇到的问题
PCL1.12.1**①**下载地址:/PointCloudLibrary/pcl/releases/tag/pcl-1.12.1
**②**下载链接:/PointCloudLibrary/pcl/releases
配置PCL
需安装PCL-1.12.文件
以下两步需要注意,其他地方直接点下一步即可
安装的时候选择Add PCL to the system PATH for all users,然后在系统变量中会自动生成下图变量,没有的话自行添加(图错了。。。。。。)
添加方法:点击电脑,右键选择属性,然后选择高级系统设置,点击环境变量,然后查看是否有这四个变量,没有点击新建添加(添加自己的路径),添加后点击确认
在安装过程中需要注意自己的安装路径,需要记下来
安装OpenNI2
在下列路径中,找到OpenNI2的安装包(安装包在如下图位置),自然安装即可,记住安装路径,可以直接安装在如图位置就可以,路径记住。
将下载的第二个文件 pcl-1.10. 解压后,将其中文件复制到PCL安装目录的bin目录下
环境配置
添加方法:点击电脑,右键选择属性,然后选择高级系统设置,点击环境变量,然后在系统变量里点击Path,然后添加下图所示路径(添加自己的路径),最后点击确认
VS2019配置
1、首先在VS2019新建空项目,然后在源文件中创建源文件
将运行模式改为Release x64 (这个根据自己情况来 ,也可Debug x64也行,这需要对应后面附加依赖项的添加)
3、点击VC++目录中,选择包含目录,进行编辑
然后添加如下路径(添加自己的路径)
4、点击VC++目录中,选择库目录,进行编辑
然后添加如下路径(添加自己的路径)
5、点击C/C++,选择常规,然后将SDL检查改为否
6.将pcl和vtk的lib库加入链接器,点击链接器,选择输入,点击附加依赖项,进行编辑,Debug和Release版本不一致,都写在下面了,可以直接拷贝
release版本附加依赖项的
pcl_common.lib
pcl_features.lib
pcl_filters.lib
pcl_io.lib
pcl_io_ply.lib
pcl_kdtree.lib
pcl_keypoints.lib
pcl_ml.lib
pcl_octree.lib
pcl_outofcore.lib
pcl_people.lib
pcl_recognition.lib
pcl_registration.lib
pcl_sample_consensus.lib
pcl_search.lib
pcl_segmentation.lib
pcl_stereo.lib
pcl_surface.lib
pcl_tracking.lib
pcl_visualization.lib
libboost_atomic-vc142-mt-x64-1_78.lib
libboost_bzip2-vc142-mt-x64-1_78.lib
libboost_chrono-vc142-mt-x64-1_78.lib
libboost_container-vc142-mt-x64-1_78.lib
libboost_context-vc142-mt-x64-1_78.lib
libboost_contract-vc142-mt-x64-1_78.lib
libboost_coroutine-vc142-mt-x64-1_78.lib
libboost_date_time-vc142-mt-x64-1_78.lib
libboost_exception-vc142-mt-x64-1_78.lib
libboost_filesystem-vc142-mt-x64-1_78.lib
libboost_graph-vc142-mt-x64-1_78.lib
libboost_graph_parallel-vc142-mt-x64-1_78.lib
libboost_iostreams-vc142-mt-x64-1_78.lib
libboost_json-vc142-mt-x64-1_78.lib
libboost_locale-vc142-mt-x64-1_78.lib
libboost_log-vc142-mt-x64-1_78.lib
libboost_log_setup-vc142-mt-x64-1_78.lib
libboost_math_c99-vc142-mt-x64-1_78.lib
libboost_math_c99f-vc142-mt-x64-1_78.lib
libboost_math_c99l-vc142-mt-x64-1_78.lib
libboost_math_tr1-vc142-mt-x64-1_78.lib
libboost_math_tr1f-vc142-mt-x64-1_78.lib
libboost_math_tr1l-vc142-mt-x64-1_78.lib
libboost_mpi-vc142-mt-x64-1_78.lib
libboost_nowide-vc142-mt-x64-1_78.lib
libboost_numpy38-vc142-mt-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-x64-1_78.lib
libboost_program_options-vc142-mt-x64-1_78.lib
libboost_python38-vc142-mt-x64-1_78.lib
libboost_random-vc142-mt-x64-1_78.lib
libboost_regex-vc142-mt-x64-1_78.lib
libboost_serialization-vc142-mt-x64-1_78.lib
libboost_system-vc142-mt-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-x64-1_78.lib
libboost_thread-vc142-mt-x64-1_78.lib
libboost_timer-vc142-mt-x64-1_78.lib
libboost_type_erasure-vc142-mt-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-x64-1_78.lib
libboost_wave-vc142-mt-x64-1_78.lib
libboost_wserialization-vc142-mt-x64-1_78.lib
libboost_zlib-vc142-mt-x64-1_78.lib
flann_cpp.lib
flann_cpp_s.lib
flann_s.lib
qhullstatic_r.lib
qhull_r.lib
vtkcgns-9.
vtkChartsCore-9.
vtkCommonColor-9.
vtkCommonComputationalGeometry-9.
vtkCommonCore-9.
vtkCommonDataModel-9.
vtkCommonExecutionModel-9.
vtkCommonMath-9.
vtkCommonMisc-9.
vtkCommonSystem-9.
vtkCommonTransforms-9.
vtkDICOMParser-9.
vtkDomainsChemistry-9.
vtkDomainsChemistryOpenGL2-9.
vtkdoubleconversion-9.
vtkexodusII-9.
vtkexpat-9.
vtkFiltersAMR-9.
vtkFiltersCore-9.
vtkFiltersExtraction-9.
vtkFiltersFlowPaths-9.
vtkFiltersGeneral-9.
vtkFiltersGeneric-9.
vtkFiltersGeometry-9.
vtkFiltersHybrid-9.
vtkFiltersHyperTree-9.
vtkFiltersImaging-9.
vtkFiltersModeling-9.
vtkFiltersParallel-9.
vtkFiltersParallelImaging-9.
vtkFiltersPoints-9.
vtkFiltersProgrammable-9.
vtkFiltersSelection-9.
vtkFiltersSMP-9.
vtkFiltersSources-9.
vtkFiltersStatistics-9.
vtkFiltersTexture-9.
vtkFiltersTopology-9.
vtkFiltersVerdict-9.
vtkfmt-9.
vtkfreetype-9.
vtkGeovisCore-9.
vtkgl2ps-9.
vtkglew-9.
vtkhdf5-9.
vtkhdf5_hl-9.
vtkImagingColor-9.
vtkImagingCore-9.
vtkImagingFourier-9.
vtkImagingGeneral-9.
vtkImagingHybrid-9.
vtkImagingMath-9.
vtkImagingMorphological-9.
vtkImagingSources-9.
vtkImagingStatistics-9.
vtkImagingStencil-9.
vtkInfovisCore-9.
vtkInfovisLayout-9.
vtkInteractionImage-9.
vtkInteractionStyle-9.
vtkInteractionWidgets-9.
vtkIOAMR-9.
vtkIOAsynchronous-9.
vtkIOCGNSReader-9.
vtkIOChemistry-9.
vtkIOCityGML-9.
vtkIOCONVERGECFD-9.
vtkIOCore-9.
vtkIOEnSight-9.
vtkIOExodus-9.
vtkIOExport-9.
vtkIOExportGL2PS-9.
vtkIOExportPDF-9.
vtkIOGeometry-9.
vtkIOHDF-9.
vtkIOImage-9.
vtkIOImport-9.
vtkIOInfovis-9.
vtkIOIOSS-9.
vtkIOLegacy-9.
vtkIOLSDyna-9.
vtkIOMINC-9.
vtkIOMotionFX-9.
vtkIOMovie-9.
vtkIONetCDF-9.
vtkIOOggTheora-9.
vtkIOParallel-9.
vtkIOParallelXML-9.
vtkIOPLY-9.
vtkIOSegY-9.
vtkIOSQL-9.
vtkioss-9.
vtkIOTecplotTable-9.
vtkIOVeraOut-9.
vtkIOVideo-9.
vtkIOXML-9.
vtkIOXMLParser-9.
vtkjpeg-9.
vtkjsoncpp-9.
vtkkissfft-9.
vtklibharu-9.
vtklibproj-9.
vtklibxml2-9.
vtkloguru-9.
vtklz4-9.
vtklzma-9.
vtkmetaio-9.
vtknetcdf-9.
vtkogg-9.
vtkParallelCore-9.
vtkParallelDIY-9.
vtkpng-9.
vtkpugixml-9.
vtkRenderingAnnotation-9.
vtkRenderingContext2D-9.
vtkRenderingContextOpenGL2-9.
vtkRenderingCore-9.
vtkRenderingFreeType-9.
vtkRenderingGL2PSOpenGL2-9.
vtkRenderingImage-9.
vtkRenderingLabel-9.
vtkRenderingLOD-9.
vtkRenderingOpenGL2-9.
vtkRenderingSceneGraph-9.
vtkRenderingUI-9.
vtkRenderingVolume-9.
vtkRenderingVolumeOpenGL2-9.
vtkRenderingVtkJS-9.
vtksqlite-9.
vtksys-9.
vtkTestingRendering-9.
vtktheora-9.
vtktiff-9.
vtkverdict-9.
vtkViewsContext2D-9.
vtkViewsCore-9.
vtkViewsInfovis-9.
vtkWrappingTools-9.
vtkzlib-9.
debug版本的附加依赖项:(后面通常多d或gd很好区分)
pcl_commond.lib
pcl_featuresd.lib
pcl_filtersd.lib
pcl_iod.lib
pcl_io_plyd.lib
pcl_kdtreed.lib
pcl_keypointsd.lib
pcl_mld.lib
pcl_octreed.lib
pcl_outofcored.lib
pcl_peopled.lib
pcl_recognitiond.lib
pcl_registrationd.lib
pcl_sample_consensusd.lib
pcl_searchd.lib
pcl_segmentationd.lib
pcl_stereod.lib
pcl_surfaced.lib
pcl_trackingd.lib
pcl_visualizationd.lib
libboost_atomic-vc142-mt-gd-x64-1_78.lib
libboost_bzip2-vc142-mt-gd-x64-1_78.lib
libboost_chrono-vc142-mt-gd-x64-1_78.lib
libboost_container-vc142-mt-gd-x64-1_78.lib
libboost_context-vc142-mt-gd-x64-1_78.lib
libboost_contract-vc142-mt-gd-x64-1_78.lib
libboost_coroutine-vc142-mt-gd-x64-1_78.lib
libboost_date_time-vc142-mt-gd-x64-1_78.lib
libboost_exception-vc142-mt-gd-x64-1_78.lib
libboost_filesystem-vc142-mt-gd-x64-1_78.lib
libboost_graph-vc142-mt-gd-x64-1_78.lib
libboost_graph_parallel-vc142-mt-gd-x64-1_78.lib
libboost_iostreams-vc142-mt-gd-x64-1_78.lib
libboost_json-vc142-mt-gd-x64-1_78.lib
libboost_locale-vc142-mt-gd-x64-1_78.lib
libboost_log-vc142-mt-gd-x64-1_78.lib
libboost_log_setup-vc142-mt-gd-x64-1_78.lib
libboost_math_c99-vc142-mt-gd-x64-1_78.lib
libboost_math_c99f-vc142-mt-gd-x64-1_78.lib
libboost_math_c99l-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1f-vc142-mt-gd-x64-1_78.lib
libboost_math_tr1l-vc142-mt-gd-x64-1_78.lib
libboost_mpi-vc142-mt-gd-x64-1_78.lib
libboost_nowide-vc142-mt-gd-x64-1_78.lib
libboost_numpy38-vc142-mt-gd-x64-1_78.lib
libboost_prg_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_program_options-vc142-mt-gd-x64-1_78.lib
libboost_python38-vc142-mt-gd-x64-1_78.lib
libboost_random-vc142-mt-gd-x64-1_78.lib
libboost_regex-vc142-mt-gd-x64-1_78.lib
libboost_serialization-vc142-mt-gd-x64-1_78.lib
libboost_system-vc142-mt-gd-x64-1_78.lib
libboost_test_exec_monitor-vc142-mt-gd-x64-1_78.lib
libboost_thread-vc142-mt-gd-x64-1_78.lib
libboost_timer-vc142-mt-gd-x64-1_78.lib
libboost_type_erasure-vc142-mt-gd-x64-1_78.lib
libboost_unit_test_framework-vc142-mt-gd-x64-1_78.lib
libboost_wave-vc142-mt-gd-x64-1_78.lib
libboost_wserialization-vc142-mt-gd-x64-1_78.lib
libboost_zlib-vc142-mt-gd-x64-1_78.lib
flann_cpp
flann_cpp_s
flann_s
qhullcpp_d.lib
qhullstatic_d.lib
qhullstatic_rd.lib
qhull_rd.lib
vtkcgns-9.
vtkChartsCore-9.
vtkCommonColor-9.
vtkCommonComputationalGeometry-9.
vtkCommonCore-9.
vtkCommonDataModel-9.
vtkCommonExecutionModel-9.
vtkCommonMath-9.
vtkCommonMisc-9.
vtkCommonSystem-9.
vtkCommonTransforms-9.
vtkDICOMParser-9.
vtkDomainsChemistry-9.
vtkDomainsChemistryOpenGL2-9.
vtkdoubleconversion-9.
vtkexodusII-9.
vtkexpat-9.
vtkFiltersAMR-9.
vtkFiltersCore-9.
vtkFiltersExtraction-9.
vtkFiltersFlowPaths-9.
vtkFiltersGeneral-9.
vtkFiltersGeneric-9.
vtkFiltersGeometry-9.
vtkFiltersHybrid-9.
vtkFiltersHyperTree-9.
vtkFiltersImaging-9.
vtkFiltersModeling-9.
vtkFiltersParallel-9.
vtkFiltersParallelImaging-9.
vtkFiltersPoints-9.
vtkFiltersProgrammable-9.
vtkFiltersSelection-9.
vtkFiltersSMP-9.
vtkFiltersSources-9.
vtkFiltersStatistics-9.
vtkFiltersTexture-9.
vtkFiltersTopology-9.
vtkFiltersVerdict-9.
vtkfmt-9.
vtkfreetype-9.
vtkGeovisCore-9.
vtkgl2ps-9.
vtkglew-9.
vtkhdf5-9.
vtkhdf5_hl-9.
vtkImagingColor-9.
vtkImagingCore-9.
vtkImagingFourier-9.
vtkImagingGeneral-9.
vtkImagingHybrid-9.
vtkImagingMath-9.
vtkImagingMorphological-9.
vtkImagingSources-9.
vtkImagingStatistics-9.
vtkImagingStencil-9.
vtkInfovisCore-9.
vtkInfovisLayout-9.
vtkInteractionImage-9.
vtkInteractionStyle-9.
vtkInteractionWidgets-9.
vtkIOAMR-9.
vtkIOAsynchronous-9.
vtkIOCGNSReader-9.
vtkIOChemistry-9.
vtkIOCityGML-9.
vtkIOCONVERGECFD-9.
vtkIOCore-9.
vtkIOEnSight-9.
vtkIOExodus-9.
vtkIOExport-9.
vtkIOExportGL2PS-9.
vtkIOExportPDF-9.
vtkIOGeometry-9.
vtkIOHDF-9.
vtkIOImage-9.
vtkIOImport-9.
vtkIOInfovis-9.
vtkIOIOSS-9.
vtkIOLegacy-9.
vtkIOLSDyna-9.
vtkIOMINC-9.
vtkIOMotionFX-9.
vtkIOMovie-9.
vtkIONetCDF-9.
vtkIOOggTheora-9.
vtkIOParallel-9.
vtkIOParallelXML-9.
vtkIOPLY-9.
vtkIOSegY-9.
vtkIOSQL-9.
vtkioss-9.
vtkIOTecplotTable-9.
vtkIOVeraOut-9.
vtkIOVideo-9.
vtkIOXML-9.
vtkIOXMLParser-9.
vtkjpeg-9.
vtkjsoncpp-9.
vtkkissfft-9.
vtklibharu-9.
vtklibproj-9.
vtklibxml2-9.
vtkloguru-9.
vtklz4-9.
vtklzma-9.
vtkmetaio-9.
vtknetcdf-9.
vtkogg-9.
vtkParallelCore-9.
vtkParallelDIY-9.
vtkpng-9.
vtkpugixml-9.
vtkRenderingAnnotation-9.
vtkRenderingContext2D-9.
vtkRenderingContextOpenGL2-9.
vtkRenderingCore-9.
vtkRenderingFreeType-9.
vtkRenderingGL2PSOpenGL2-9.
vtkRenderingImage-9.
vtkRenderingLabel-9.
vtkRenderingLOD-9.
vtkRenderingOpenGL2-9.
vtkRenderingSceneGraph-9.
vtkRenderingUI-9.
vtkRenderingVolume-9.
vtkRenderingVolumeOpenGL2-9.
vtkRenderingVtkJS-9.
vtksqlite-9.
vtksys-9.
vtkTestingRendering-9.
vtktheora-9.
vtktiff-9.
vtkverdict-9.
vtkViewsContext2D-9.
vtkViewsCore-9.
vtkViewsInfovis-9.
vtkWrappingTools-9.
vtkzlib-9.
在预处理器定义处进行修改,内容如下
_CRT_SECURE_NO_WARNINGS
BOOST_ALL_NO_LIB
BOOST_USE_WINDOWS_H
NOMINMAX
_SCL_SECURE_NO_WARNINGS
_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING
确定-应用。到这一步就完成了所有的配置。
进行调试
#include<pcl/visualization/cloud_viewer.h>
#include<iostream>//标准C++库中的输入输出类相关头文件。
#include<pcl/io/>
#include<pcl/io/pcd_io.h>//pcd 读写类相关的头文件。
#include<pcl/io/ply_io.h>
#include<pcl/point_types.h> //PCL中支持的点类型头文件。
int main()
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
char strfilepath[256] = "C:\\Users\\Administrator\\Desktop\\";//选择自己的pcd文件的路径即可,例C:\\Users\\rabbit_t.pcd 双斜杠
if (-1 == pcl::io::loadPCDFile(strfilepath, *cloud)) //打开点云文件
{
std::cout << "error input!" << std::endl;
return -1;
}
std::cout << cloud->points.size() << std::endl;
pcl::visualization::CloudViewer viewer("Cloud Viewer"); //创建viewer对象
viewer.showCloud(cloud);
system("pause");
return 0;
}
测试如图
**
## 参考链接:①https:///y18771025420/article/details/110517524
②https:///wjclc123/article/details/123470908
**