闲话不多说,具体在windows下下载PCL与解压pcl可以看https://www.yuque.com/huangzhongqing/pcl/这位大佬的文章,那我就具体说一下踩过点坑:
踩坑点1:
按照大佬的文章的步骤进行解压与下载,我的PCL环境下在了K盘中,但是最后不知怎么的我的openni2文件夹下在了C盘里,也就是说3rdparty文件夹下的openni2没有下一层目录了,我的做法就是把c盘里openni2目录下的文件都复制到了K盘中。当然也可以不复制,在配置环境变量时记得要写c盘的openni2不要写K盘的就可以。
踩坑点2:
安装PCL时,如果选择添加环境变量可能会出现“环境变量长度超过1023”这样类似的错误,这时候需要手动配置一下,下面是我的配置办法:
在这张图中,这三个变量应该是安装的时候可以自动写到环境变量里的,第三行是我手动修改了,放到了k盘里,其实可以不放,只要记得是C盘就行,前两行也同样。还有就是下图这个
也是可以自动填写上的,需要我们手动添加的是下面这些:
我们在Path里,尾部加上这些就可以了。
踩坑点3:
链接库问题,这也是比较棘手的问题之一,在3rdparty下的每一个文件夹下的lib文件夹中,新建一个txt文件,内容填写:DIR *.lib /B >liblist.txt
DIR .lib /B:列出当前目录中所有以 .lib 为扩展名的文件,且使用简洁的输出格式。DIR:显示目录中的文件和子目录列表。*.lib:匹配所有以 .lib 结尾的文件。/B:使用简洁格式输出,只显示文件名,不显示日期、时间、文件大小等详细信息。liblist.txt是你需要重定向的文件名。最后再把写入命令的txt后缀修改为bat,双击执行即可吧lib文件名称全部写入到liblist.txt中。完成上述操作后,当我们执行时,可能会出现下图的错误:
这个错误的排除也是耗费了我很长时间,最后找到了原因:上面我们得到的liblist列表中,同时包括debug和release版本的lib,那么vs执行的时候就会产生冲突,从而报错,具体做法是我们可以去掉非debug版本的lib文件,比如你把“pcl_registrationd.lib”和 “pcl_registration.lib” 都写上去了那么就去掉后面不带d的,前面有“gd”后缀的一样,保留它,去掉不带gd的。下面是1.14.1我整理好的库:
libboost_atomic-vc143-mt-gd-x64-1_84.lib
libboost_bzip2-vc143-mt-gd-x64-1_84.lib
libboost_chrono-vc143-mt-gd-x64-1_84.lib
libboost_container-vc143-mt-gd-x64-1_84.lib
libboost_context-vc143-mt-gd-x64-1_84.lib
libboost_contract-vc143-mt-gd-x64-1_84.lib
libboost_coroutine-vc143-mt-gd-x64-1_84.lib
libboost_date_time-vc143-mt-gd-x64-1_84.lib
libboost_exception-vc143-mt-gd-x64-1_84.lib
libboost_fiber-vc143-mt-gd-x64-1_84.lib
libboost_filesystem-vc143-mt-gd-x64-1_84.lib
libboost_graph-vc143-mt-gd-x64-1_84.lib
libboost_graph_parallel-vc143-mt-gd-x64-1_84.lib
libboost_iostreams-vc143-mt-gd-x64-1_84.lib
libboost_json-vc143-mt-gd-x64-1_84.lib
libboost_locale-vc143-mt-gd-x64-1_84.lib
libboost_log-vc143-mt-gd-x64-1_84.lib
libboost_log_setup-vc143-mt-gd-x64-1_84.lib
libboost_math_c99-vc143-mt-gd-x64-1_84.lib
libboost_math_c99f-vc143-mt-gd-x64-1_84.lib
libboost_math_c99l-vc143-mt-gd-x64-1_84.lib
libboost_math_tr1-vc143-mt-gd-x64-1_84.lib
libboost_math_tr1f-vc143-mt-gd-x64-1_84.lib
libboost_math_tr1l-vc143-mt-gd-x64-1_84.lib
libboost_mpi-vc143-mt-gd-x64-1_84.lib
libboost_nowide-vc143-mt-gd-x64-1_84.lib
libboost_numpy310-vc143-mt-gd-x64-1_84.lib
libboost_prg_exec_monitor-vc143-mt-gd-x64-1_84.lib
libboost_program_options-vc143-mt-gd-x64-1_84.lib
libboost_python310-vc143-mt-gd-x64-1_84.lib
libboost_random-vc143-mt-gd-x64-1_84.lib
libboost_regex-vc143-mt-gd-x64-1_84.lib
libboost_serialization-vc143-mt-gd-x64-1_84.lib
libboost_stacktrace_noop-vc143-mt-gd-x64-1_84.lib
libboost_stacktrace_windbg-vc143-mt-gd-x64-1_84.lib
libboost_stacktrace_windbg_cached-vc143-mt-gd-x64-1_84.lib
libboost_system-vc143-mt-gd-x64-1_84.lib
libboost_test_exec_monitor-vc143-mt-gd-x64-1_84.lib
libboost_thread-vc143-mt-gd-x64-1_84.lib
libboost_timer-vc143-mt-gd-x64-1_84.lib
libboost_type_erasure-vc143-mt-gd-x64-1_84.lib
libboost_unit_test_framework-vc143-mt-gd-x64-1_84.lib
libboost_url-vc143-mt-gd-x64-1_84.lib
libboost_wave-vc143-mt-gd-x64-1_84.lib
libboost_wserialization-vc143-mt-gd-x64-1_84.lib
libboost_zlib-vc143-mt-gd-x64-1_84.lib
flann-gd.lib
flann_cpp-gd.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
qhullcpp.lib
qhullcpp_d.lib
qhullstatic.lib
qhullstatic_d.lib
qhullstatic_rd.lib
qhull_rd.lib
vtkcgns-9.3-gd.lib
vtkChartsCore-9.3-gd.lib
vtkCommonColor-9.3-gd.lib
vtkCommonComputationalGeometry-9.3-gd.lib
vtkCommonCore-9.3-gd.lib
vtkCommonDataModel-9.3-gd.lib
vtkCommonExecutionModel-9.3-gd.lib
vtkCommonMath-9.3-gd.lib
vtkCommonMisc-9.3-gd.lib
vtkCommonSystem-9.3-gd.lib
vtkCommonTransforms-9.3-gd.lib
vtkDICOMParser-9.3-gd.lib
vtkDomainsChemistry-9.3-gd.lib
vtkDomainsChemistryOpenGL2-9.3-gd.lib
vtkdoubleconversion-9.3-gd.lib
vtkexodusII-9.3-gd.lib
vtkexpat-9.3-gd.lib
vtkFiltersAMR-9.3-gd.lib
vtkFiltersCellGrid-9.3-gd.lib
vtkFiltersCore-9.3-gd.lib
vtkFiltersExtraction-9.3-gd.lib
vtkFiltersFlowPaths-9.3-gd.lib
vtkFiltersGeneral-9.3-gd.lib
vtkFiltersGeneric-9.3-gd.lib
vtkFiltersGeometry-9.3-gd.lib
vtkFiltersGeometryPreview-9.3-gd.lib
vtkFiltersHybrid-9.3-gd.lib
vtkFiltersHyperTree-9.3-gd.lib
vtkFiltersImaging-9.3-gd.lib
vtkFiltersModeling-9.3-gd.lib
vtkFiltersParallel-9.3-gd.lib
vtkFiltersParallelImaging-9.3-gd.lib
vtkFiltersPoints-9.3-gd.lib
vtkFiltersProgrammable-9.3-gd.lib
vtkFiltersReduction-9.3-gd.lib
vtkFiltersSelection-9.3-gd.lib
vtkFiltersSMP-9.3-gd.lib
vtkFiltersSources-9.3-gd.lib
vtkFiltersStatistics-9.3-gd.lib
vtkFiltersTensor-9.3-gd.lib
vtkFiltersTexture-9.3-gd.lib
vtkFiltersTopology-9.3-gd.lib
vtkFiltersVerdict-9.3-gd.lib
vtkfmt-9.3-gd.lib
vtkfreetype-9.3-gd.lib
vtkGeovisCore-9.3-gd.lib
vtkgl2ps-9.3-gd.lib
vtkglew-9.3-gd.lib
vtkhdf5-9.3-gd.lib
vtkhdf5_hl-9.3-gd.lib
vtkImagingColor-9.3-gd.lib
vtkImagingCore-9.3-gd.lib
vtkImagingFourier-9.3-gd.lib
vtkImagingGeneral-9.3-gd.lib
vtkImagingHybrid-9.3-gd.lib
vtkImagingMath-9.3-gd.lib
vtkImagingMorphological-9.3-gd.lib
vtkImagingSources-9.3-gd.lib
vtkImagingStatistics-9.3-gd.lib
vtkImagingStencil-9.3-gd.lib
vtkInfovisCore-9.3-gd.lib
vtkInfovisLayout-9.3-gd.lib
vtkInteractionImage-9.3-gd.lib
vtkInteractionStyle-9.3-gd.lib
vtkInteractionWidgets-9.3-gd.lib
vtkIOAMR-9.3-gd.lib
vtkIOAsynchronous-9.3-gd.lib
vtkIOCellGrid-9.3-gd.lib
vtkIOCesium3DTiles-9.3-gd.lib
vtkIOCGNSReader-9.3-gd.lib
vtkIOChemistry-9.3-gd.lib
vtkIOCityGML-9.3-gd.lib
vtkIOCONVERGECFD-9.3-gd.lib
vtkIOCore-9.3-gd.lib
vtkIOEnSight-9.3-gd.lib
vtkIOExodus-9.3-gd.lib
vtkIOExport-9.3-gd.lib
vtkIOExportGL2PS-9.3-gd.lib
vtkIOExportPDF-9.3-gd.lib
vtkIOFLUENTCFF-9.3-gd.lib
vtkIOGeometry-9.3-gd.lib
vtkIOHDF-9.3-gd.lib
vtkIOImage-9.3-gd.lib
vtkIOImport-9.3-gd.lib
vtkIOInfovis-9.3-gd.lib
vtkIOIOSS-9.3-gd.lib
vtkIOLegacy-9.3-gd.lib
vtkIOLSDyna-9.3-gd.lib
vtkIOMINC-9.3-gd.lib
vtkIOMotionFX-9.3-gd.lib
vtkIOMovie-9.3-gd.lib
vtkIONetCDF-9.3-gd.lib
vtkIOOggTheora-9.3-gd.lib
vtkIOParallel-9.3-gd.lib
vtkIOParallelXML-9.3-gd.lib
vtkIOPLY-9.3-gd.lib
vtkIOSegY-9.3-gd.lib
vtkIOSQL-9.3-gd.lib
vtkioss-9.3-gd.lib
vtkIOTecplotTable-9.3-gd.lib
vtkIOVeraOut-9.3-gd.lib
vtkIOVideo-9.3-gd.lib
vtkIOXML-9.3-gd.lib
vtkIOXMLParser-9.3-gd.lib
vtkjpeg-9.3-gd.lib
vtkjsoncpp-9.3-gd.lib
vtkkissfft-9.3-gd.lib
vtklibharu-9.3-gd.lib
vtklibproj-9.3-gd.lib
vtklibxml2-9.3-gd.lib
vtkloguru-9.3-gd.lib
vtklz4-9.3-gd.lib
vtklzma-9.3-gd.lib
vtkmetaio-9.3-gd.lib
vtknetcdf-9.3-gd.lib
vtkogg-9.3-gd.lib
vtkParallelCore-9.3-gd.lib
vtkParallelDIY-9.3-gd.lib
vtkpng-9.3-gd.lib
vtkpugixml-9.3-gd.lib
vtkRenderingAnnotation-9.3-gd.lib
vtkRenderingCellGrid-9.3-gd.lib
vtkRenderingContext2D-9.3-gd.lib
vtkRenderingContextOpenGL2-9.3-gd.lib
vtkRenderingCore-9.3-gd.lib
vtkRenderingFreeType-9.3-gd.lib
vtkRenderingGL2PSOpenGL2-9.3-gd.lib
vtkRenderingHyperTreeGrid-9.3-gd.lib
vtkRenderingImage-9.3-gd.lib
vtkRenderingLabel-9.3-gd.lib
vtkRenderingLICOpenGL2-9.3-gd.lib
vtkRenderingLOD-9.3-gd.lib
vtkRenderingOpenGL2-9.3-gd.lib
vtkRenderingSceneGraph-9.3-gd.lib
vtkRenderingUI-9.3-gd.lib
vtkRenderingVolume-9.3-gd.lib
vtkRenderingVolumeOpenGL2-9.3-gd.lib
vtkRenderingVtkJS-9.3-gd.lib
vtksqlite-9.3-gd.lib
vtksys-9.3-gd.lib
vtkTestingRendering-9.3-gd.lib
vtktheora-9.3-gd.lib
vtktiff-9.3-gd.lib
vtkverdict-9.3-gd.lib
vtkViewsContext2D-9.3-gd.lib
vtkViewsCore-9.3-gd.lib
vtkViewsInfovis-9.3-gd.lib
vtkWrappingTools-9.3-gd.lib
vtkzlib-9.3-gd.lib
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
上面这个问题,同样适用于执行结果不报错,但是却在console窗口显示非0退出的语句这个问题。
踩坑点4:
无法解析的外部符号 "void __cdecl vtkRenderingOpenGL_AutoInit_Construct(void)" (?vtkRenderingOpenGL_AutoInit_Construct@@YAXXZ),函数 "public: __cdecl `anonymous namespace'::vtkRenderingOpenGL_ModuleInit::vtkRenderingOpenGL_ModuleInit(void)" (??0vtkRenderingOpenGL_ModuleInit@?A0xdbae2661@@QEAA@XZ)
我用的是文章开头大佬的文章中的代码:
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);
VTK_MODULE_INIT(vtkRenderingOpenGL);
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("rabbit.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;
}
只需要把VTK_MODULE_INIT(vtkRenderingOpenGL);改为VTK_MODULE_INIT(vtkRenderingOpenGL2);即可
标签:PCL1.14,lib,windows11,vc143,mt,gd,VS2022,84,9.3 From: https://www.cnblogs.com/kyszdsmz/p/18316623