C + + get PCL 1.11 Additional dependencies for 1

preface

For a complete library matching tutorial, see: Visual studio 2019 configuring point cloud library pcl1 eleven point one

1, Semi automatic acquisition

1. Get dependencies of VTK

  open the installation directory of PCL and find the VTK lib folder

Select the path and enter cmd

Press Enter to display the following interface

Then enter: dir / B / on > list Txt and press enter

  at this time, open the directory corresponding to Lu Jin and add a list Txt file, which stores the names of all link libraries in your folder.

  open the list Txt file, delete cmake and list Txt two lines and save (be careful not to leave blank lines)

  because the link libraries of each Debug version and Release version are next to each other. Just write a read document and save it separately.
The specific code is as follows: (the main function is to read a txt file and output odd and even lines to a new txt document separately.)

#include <iostream>
#include <string>
#include <fstream> 

using namespace std;

int main()
{
	ifstream txtfile;       // Open read file
	ofstream release, debug;// Saved files
	string line;
	
	txtfile.open("list.txt", ios::in);
	release.open("release Additional dependencies.txt", ios::app);
	debug.open("debug Additional dependencies.txt", ios::app);

	int index = 0;               // Used to judge parity
	while (!txtfile.eof())       // If the end of the file is not reached, the loop will continue
	{
		getline(txtfile, line);  // Read line by line
		
		if (index % 2 == 0)      // The remainder of judgment divided by 2 is the judgment of parity
		{
			release << line << endl;
		}
		else
		{
			debug << line << endl;
		}
		index++;
	}
	//Close file
	txtfile.close();   
	release.close();
	debug.close();

	return 0;
}

2. Get dependencies for PCL

  open the installation directory of PCL and find the lib folder



Select the path and enter cmd

Press Enter to display the following interface

Then enter: dir / B / on > a_ list. Txt and press enter

  at this time, open the directory of your corresponding Lu Jin and add an a_list.txt file, which stores the names of all link libraries in your folder.
Open a_list.txt file, delete a_list.txt and pkgconfig and save them (be careful not to leave blank lines)

  because the link libraries of each Debug version and Release version are next to each other. Just write a read document and save it separately.
The specific code is as follows: (the main function is to read a txt file and output odd and even lines to a new txt document separately.)

#include <iostream>
#include <string>
#include <fstream> 

using namespace std;

int main()
{
	ifstream txtfile;       // Open read file
	ofstream release, debug;// Saved files
	string line;
	
	txtfile.open("a_list.txt", ios::in);
	release.open("pcl_release Additional dependencies.txt", ios::app);
	debug.open("pcl_debug Additional dependencies.txt", ios::app);

	int index = 0;               // Used to judge parity
	while (!txtfile.eof())       // If the end of the file is not reached, the loop will continue
	{
		getline(txtfile, line);  // Read line by line
		
		if (index % 2 == 0)      // The remainder of judgment divided by 2 is the judgment of parity
		{
			release << line << endl;
		}
		else
		{
			debug << line << endl;
		}
		index++;
	}
	//Close file
	txtfile.close();   
	release.close();
	debug.close();

	return 0;
}

  attach release to dependency Copy and paste the contents in txt into pcl_release additional dependencies Txt to obtain the complete additional dependencies of the release version, and the same is true for the Debug version.

2, Automatic acquisition

  this code is applicable to automatic acquisition of pcl1 As for the additional dependencies of 11.1, we don't know whether the dependencies of other versions of PCL can be used.

#include <io.h>
#include <vector>
#include <string>
#include <fstream>
#include <iostream>

using namespace std;

#pragma region / / read the lib file from the folder
vector<string>batchFetchingLib(string& folder_path)
{
	string filename_suffix = "/*lib"; // The file name suffix (. lib) of the lib file
	vector<string>files;
	struct _finddata_t fileinfo;
	intptr_t handle;
	handle = _findfirst((folder_path + filename_suffix).data(), &fileinfo);
	if (handle == -1)
	{
		printf("The path entered is incorrect");
		exit(-1);
	}
	else
	{
		files.push_back(fileinfo.name);

		while (_findnext(handle, &fileinfo) == 0)
		{
			if (strcmp(fileinfo.name, ".") == 0 || strcmp(fileinfo.name, "..") == 0)
				continue;
			files.push_back(fileinfo.name);
		}
	}
	_findclose(handle);

	return files;
}
#pragma endregion

int main()
{
	string pcl_lib_path("D://PCL 1.11.1//lib "); / / read the path of the Lib file
	string vtk_lib_path("D://PCL 1.11.1//3rdParty//VTK//lib "); / / read the path of VTK lib file

	vector<string>PCL = batchFetchingLib(pcl_lib_path);        // Get lib file name
	vector<string>VTK = batchFetchingLib(vtk_lib_path);        // Get VTK lib file name

	ofstream release, debug;// Saved files
	release.open("PCL1.11.1_Release Additional dependencies.txt", ios::app);
	debug.open("PCL1.11.1_Debug Additional dependencies.txt", ios::app);

	for (size_t i = 0; i < PCL.size(); ++i)
	{
		(i % 2 == 0) ? release << PCL[i] << endl : debug << PCL[i] << endl;
	}

	for (size_t i = 0; i < VTK.size(); ++i)
	{
		(i % 2 != 0) ? release << VTK[i] << endl : debug << VTK[i] << endl;
	}

	release.close();
	debug.close();

	cout << "Additional dependencies obtained!!!" << endl;
	
	return 0;
}

Keywords: IDE Visual Studio visualstudio

Added by CapEsiouS on Fri, 24 Dec 2021 17:04:24 +0200