The construction of PCL and MFC (VS2013+1.8.0PCL) is super detailed!!!

Recently, point cloud data processing needs to be used, so PCL point cloud library needs to be installed, which has been struggling for a long time. Due to various reasons such as test delay, etc., it has not been configured successfully for a long time. Only 1.9.1 PCL is configured on VS2017, and console applications can be created, but I always report an error when I want to configure MFC. Later, this record is also available, which is replaced by vs2013 + 1.8.0 PC 50. After a lot of drumming, we finally finished the configuration. The following is the environment configuration record (I will upload the property sheet to CSDN download, which can be downloaded CSDN Download , 1 point. If there is no point partner, you can also add my QQ1604737936, which I will send directly to you).
Preparatory work:
reference: https://blog.csdn.net/qq_42570058/article/details/80891372
Install VS2013 and 1.8.0PCL. The specific installation steps are in accordance with the references.
VS2013 link: https://pan.baidu.com/s/1aEY8IlcCS5mzkLfE2g7CKg
Extraction code: zye8
1.8.0 PCL link: https://pan.baidu.com/s/13rShx4sonLv7bKZ8nFD9CQ
Extraction code: of7l
Source code link of the book "getting started with point cloud library to master":
https://pan.baidu.com/s/1EaWG73Cl2ITZX20vwPljBw
Extraction code: b929

(1) Create a new MFC dialog project and change the configuration manager to x64

(2) Modify properties
Click the property manager, find Debug|x64, right-click it, and create a new property file named PCL | MFC | propertysheet.props; double click PCL | MFC | propertysheet.props to enter the property modification page.




Click the general under C/C + +, click the additional include directory on the right interface, and click the down arrow.

Add the following installation paths of PCL in sequence (the author's PCL is installed on disk D, and readers need to change the secondary path to their own installation path):
D:\PCL 1.8.0\include\pcl-1.8
D:\PCL 1.8.0\3rdParty\Boost\include\boost-1_59
D:\PCL 1.8.0\3rdParty\Eigen\eigen3
D:\PCL 1.8.0\3rdParty\FLANN\include
D:\PCL 1.8.0\3rdParty\OpenNI2\Include
D:\PCL 1.8.0\3rdParty\Qhull\include
D:\PCL 1.8.0\3rdParty\VTK\include\vtk-7.0
After success, as shown in the following figure:
! [insert picture description here] (https://img-blog.csdnimg.cn/20200113174321348. PNG? X-oss-process = image / watermark, type ﹣ zmfuz3pozw5nagvpdgk, shadow ﹣ 10, text ﹣ ahr0chm6ly9ibg9nlmnzg4ubmv0l3dlaxhpbl80mze4njxnw = =, size ﹣ 16, color ﹣ ffff, t ﹣ 70
Click general under linker, click the additional library directory on the right interface, and click the box on the right to add the additional library directory.

Add the following paths in order (again, readers need to change paths to their own):
D:\PCL 1.8.0\lib
D:\PCL 1.8.0\3rdParty\Boost\lib
D:\PCL 1.8.0\3rdParty\FLANN\lib
D:\PCL 1.8.0\3rdParty\OpenNI2\Lib
D:\PCL 1.8.0\3rdParty\Qhull\lib
D:\PCL 1.8.0\3rdParty\VTK\lib

Click the input under the linker, click the additional dependency in the right interface, and start to add the additional dependency. Different versions of PCL have different additional dependencies, so you must use your own version of the additional dependencies. You can use a cmd command to export the additional dependencies so that they can be directly copied here.
Here's how to find cmd to open.
First find the installation path of VTK lib under PCL and copy it.

Open cmd and enter the following statement as shown in the figure:

cd /d D:\PCL 1.8.0\3rdParty\VTK\lib
dir /b *.lib*>0.txt

(remember, spaces in statements cannot be missing)
As shown in the figure below, the 0.txt document already contains all the additional dependencies.

Copy the contents in 0.txt to the additional dependencies, as shown in the following figure:

(in fact, I have configuration problems when running, but sometimes it can be used. The most real suggestion is to copy the content I copied.)
Here is what I copied:

pcl_apps_debug.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_simulation_debug.lib
pcl_stereo_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
libboost_atomic-vc120-mt-gd-1_59.lib
libboost_chrono-vc120-mt-gd-1_59.lib
libboost_container-vc120-mt-gd-1_59.lib
libboost_context-vc120-mt-gd-1_59.lib
libboost_coroutine-vc120-mt-gd-1_59.lib
libboost_date_time-vc120-mt-gd-1_59.lib
libboost_exception-vc120-mt-gd-1_59.lib
libboost_filesystem-vc120-mt-gd-1_59.lib
libboost_graph-vc120-mt-gd-1_59.lib
libboost_iostreams-vc120-mt-gd-1_59.lib
libboost_locale-vc120-mt-gd-1_59.lib
libboost_log-vc120-mt-gd-1_59.lib
libboost_log_setup-vc120-mt-gd-1_59.lib
libboost_math_c99-vc120-mt-gd-1_59.lib
libboost_math_c99f-vc120-mt-gd-1_59.lib
libboost_math_c99l-vc120-mt-gd-1_59.lib
libboost_math_tr1-vc120-mt-gd-1_59.lib
libboost_math_tr1f-vc120-mt-gd-1_59.lib
libboost_math_tr1l-vc120-mt-gd-1_59.lib
libboost_mpi-vc120-mt-gd-1_59.lib
libboost_prg_exec_monitor-vc120-mt-gd-1_59.lib
libboost_program_options-vc120-mt-gd-1_59.lib
libboost_random-vc120-mt-gd-1_59.lib
libboost_regex-vc120-mt-gd-1_59.lib
libboost_serialization-vc120-mt-gd-1_59.lib
libboost_signals-vc120-mt-gd-1_59.lib
libboost_system-vc120-mt-gd-1_59.lib
libboost_test_exec_monitor-vc120-mt-gd-1_59.lib
libboost_thread-vc120-mt-gd-1_59.lib
libboost_timer-vc120-mt-gd-1_59.lib
libboost_unit_test_framework-vc120-mt-gd-1_59.lib
libboost_wave-vc120-mt-gd-1_59.lib
libboost_wserialization-vc120-mt-gd-1_59.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
flann-gd.lib
OpenNI2.lib
qhullstatic_r-gd.lib
qhull_p-gd.lib
qhull_r-gd.lib
qhullcpp-gd.lib
qhull-gd.lib
qhullstatic-gd.lib
vtkalglib-7.0-gd.lib
vtkChartsCore-7.0-gd.lib
vtkCommonColor-7.0-gd.lib
vtkCommonComputationalGeometry-7.0-gd.lib
vtkCommonCore-7.0-gd.lib
vtkCommonDataModel-7.0-gd.lib
vtkCommonExecutionModel-7.0-gd.lib
vtkCommonMath-7.0-gd.lib
vtkCommonMisc-7.0-gd.lib
vtkCommonSystem-7.0-gd.lib
vtkCommonTransforms-7.0-gd.lib
vtkDICOMParser-7.0-gd.lib
vtkDomainsChemistry-7.0-gd.lib
vtkDomainsChemistryOpenGL2-7.0-gd.lib
vtkexoIIc-7.0-gd.lib
vtkexpat-7.0-gd.lib
vtkFiltersAMR-7.0-gd.lib
vtkFiltersCore-7.0-gd.lib
vtkFiltersExtraction-7.0-gd.lib
vtkFiltersFlowPaths-7.0-gd.lib
vtkFiltersGeneral-7.0-gd.lib
vtkFiltersGeneric-7.0-gd.lib
vtkFiltersGeometry-7.0-gd.lib
vtkFiltersHybrid-7.0-gd.lib
vtkFiltersHyperTree-7.0-gd.lib
vtkFiltersImaging-7.0-gd.lib
vtkFiltersModeling-7.0-gd.lib
vtkFiltersParallel-7.0-gd.lib
vtkFiltersParallelImaging-7.0-gd.lib
vtkFiltersProgrammable-7.0-gd.lib
vtkFiltersSelection-7.0-gd.lib
vtkFiltersSMP-7.0-gd.lib
vtkFiltersSources-7.0-gd.lib
vtkFiltersStatistics-7.0-gd.lib
vtkFiltersTexture-7.0-gd.lib
vtkFiltersVerdict-7.0-gd.lib
vtkfreetype-7.0-gd.lib
vtkGeovisCore-7.0-gd.lib
vtkglew-7.0-gd.lib
vtkGUISupportQt-7.0-gd.lib
vtkGUISupportQtSQL-7.0-gd.lib
vtkhdf5-7.0-gd.lib
vtkhdf5_hl-7.0-gd.lib
vtkImagingColor-7.0-gd.lib
vtkImagingCore-7.0-gd.lib
vtkImagingFourier-7.0-gd.lib
vtkImagingGeneral-7.0-gd.lib
vtkImagingHybrid-7.0-gd.lib
vtkImagingMath-7.0-gd.lib
vtkImagingMorphological-7.0-gd.lib
vtkImagingSources-7.0-gd.lib
vtkImagingStatistics-7.0-gd.lib
vtkImagingStencil-7.0-gd.lib
vtkInfovisCore-7.0-gd.lib
vtkInfovisLayout-7.0-gd.lib
vtkInteractionImage-7.0-gd.lib
vtkInteractionStyle-7.0-gd.lib
vtkInteractionWidgets-7.0-gd.lib
vtkIOAMR-7.0-gd.lib
vtkIOCore-7.0-gd.lib
vtkIOEnSight-7.0-gd.lib
vtkIOExodus-7.0-gd.lib
vtkIOExport-7.0-gd.lib
vtkIOGeometry-7.0-gd.lib
vtkIOImage-7.0-gd.lib
vtkIOImport-7.0-gd.lib
vtkIOInfovis-7.0-gd.lib
vtkIOLegacy-7.0-gd.lib
vtkIOLSDyna-7.0-gd.lib
vtkIOMINC-7.0-gd.lib
vtkIOMovie-7.0-gd.lib
vtkIONetCDF-7.0-gd.lib
vtkIOParallel-7.0-gd.lib
vtkIOParallelXML-7.0-gd.lib
vtkIOPLY-7.0-gd.lib
vtkIOSQL-7.0-gd.lib
vtkIOVideo-7.0-gd.lib
vtkIOXML-7.0-gd.lib
vtkIOXMLParser-7.0-gd.lib
vtkjpeg-7.0-gd.lib
vtkjsoncpp-7.0-gd.lib
vtklibxml2-7.0-gd.lib
vtkmetaio-7.0-gd.lib
vtkNetCDF-7.0-gd.lib
vtkNetCDF_cxx-7.0-gd.lib
vtkoggtheora-7.0-gd.lib
vtkParallelCore-7.0-gd.lib
vtkpng-7.0-gd.lib
vtkproj4-7.0-gd.lib
vtkRenderingAnnotation-7.0-gd.lib
vtkRenderingContext2D-7.0-gd.lib
vtkRenderingContextOpenGL2-7.0-gd.lib
vtkRenderingCore-7.0-gd.lib
vtkRenderingFreeType-7.0-gd.lib
vtkRenderingImage-7.0-gd.lib
vtkRenderingLabel-7.0-gd.lib
vtkRenderingLOD-7.0-gd.lib
vtkRenderingOpenGL2-7.0-gd.lib
vtkRenderingQt-7.0-gd.lib
vtkRenderingVolume-7.0-gd.lib
vtkRenderingVolumeOpenGL2-7.0-gd.lib
vtksqlite-7.0-gd.lib
vtksys-7.0-gd.lib
vtktiff-7.0-gd.lib
vtkverdict-7.0-gd.lib
vtkViewsContext2D-7.0-gd.lib
vtkViewsCore-7.0-gd.lib
vtkViewsInfovis-7.0-gd.lib
vtkViewsQt-7.0-gd.lib
vtkzlib-7.0-gd.lib

In addition, in order not to report C4996 errors, the preprocessor under C/C + + needs to add = = ﹣ SCL ﹣ secure ﹣ no ﹣ warnings==
After the above steps, the configuration is basically completed.
Let's add some simple test code to test whether the environment is built successfully.

(3) Create the interface, and name Picture control, open control and close control with IDC ﹣ pcdview, IDC ﹣ open and IDC ﹣ close.

(4) Modify code
Modify and add in cpp

```cpp
#undef min / / add new code//
#undef max 	
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
//Comment out the original three lines of code
//#ifdef _DEBUG
//#define new DEBUG_NEW
//#endif
//New increase
using namespace pcl;
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++;
}
//Return to the Dlg interface, double-click the open button, enter the code of the open button, and enter the following code

```cpp
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
	pcl::io::loadPCDFile("rabbit.pcd", *cloud);
	pcl::visualization::CloudViewer viewer("Cloud Viewer");
	//The showCloud function is synchronized, waiting here until the rendering is displayed
	viewer.showCloud(cloud);
	//This registration function is called only once during visualization
	viewer.runOnVisualizationThreadOnce(viewerOneOff);
	//This registration function is called every time the output is rendered
	viewer.runOnVisualizationThread(viewerPsycho);
	while (!viewer.wasStopped())
	{
		//Additional processing can be added here
		user_data++;
	}
	UpdateData(FALSE); //Change from return 0; in cloud [viewer] to UpdateData(FALSE

);

(5) Commissioning
If the following interface appears, the environment is built successfully. Only a small step has been taken after the success of environment construction. There is still a long way to go for the next project creation. Come on, brother!

Published 8 original articles, won praise 5, visited 272
Private letter follow

Tags: PCL Linker

Posted on Mon, 13 Jan 2020 06:35:09 -0500 by hnissani