Compilation and configuration of visual studio 2019 under Win10 system: lastools-v2 zero

1, Overview


The library has been updated for some reason. Last updated on: January 7, 2022. Lastools version: 220107. Due to some requests, now start using git publishing. Lastools uses version control in the YYMMDD scheme. This is very common for most lasttools users, so keep this version number. In addition, we will follow the open source version of the GIT version control guide. They may also subsequently flow into the source code. Because we have something very similar to history, we directly from Version 2.0.0 Start.

2. Download and unzip

github link:

Download and unzip the contents in the red box

2, Source code compilation

2.1 opening

Use VS2019 to open lastools dsw

Migrating solutions and projects

When the following interface appears, just click OK.

2.2 remove items that failed to load

2.3 modify code

Open the LASlib header file mydefs HPP, locate to line 69, only keep #if defined(_MSC_VER), delete or comment other codes in this line.

2.4 configuration manager

The configuration process is shown in the following figure:

2.5 modify output directory

Right click LASlib - properties - configuration properties - General - output directory - modify to:


2.6 modify header file directory

Right click LASlib - configuration properties - C/C + + - General - attach include directory - delete "... \ laszip\stl"

2.7 modify runtime

Right click LASlib - properties - C/C + + - code generation - runtime - select "multithreading (/ MD)". (VS2019 defaults to multithreading / MTd. Previously, multithreading (/ MD) was selected during open3d compilation, so multithreading (/ MD) is also selected here.)

2.8 generate lib

Right click LASlib - regenerate. When the following interface appears, the lastools of debug mode is compiled successfully.

Configure release mode

Right click LASlib - configuration properties - C/C + + - General - attach include directory - delete "... \ laszip\stl"

Right click LASlib - regenerate. When the following interface appears, the release mode lastools is compiled successfully.

2.9 lib path


3, Package into Library

  1. Open LASlib lib - lib, create a new Debug and Release folder, and add LASlib Put lib into the Release folder and put laslibd Put lib into the Debug folder.
  2. New folder laslib, will \Copy the laslib and lib folders under the lasstools \ lasstools \ laslib path and put them into the new folder.
  3. Will \Copy the src folder under the path of LAStools\LAStools\LASzip and put it into the new folder. The library is encapsulated.

4, VS2019 distribution Library

My path to LASlib is:

  1. Configuration properties - C/C + + - code generation - runtime, multithreading (/ MT), consistent with the settings in step 2.7.
  2. VC + + Directory - include directory
  1. VC + + Directory - Library Directory

Release mode


Debug mode

  1. Additional dependencies

Release mode


Debug mode


5, Test code

#include <iostream> // C++
#include "lasreader.hpp"// LasReader
#include "open3d/geometry/PointCloud.h"// Open3D point cloud file
#include "open3d/visualization/utility/DrawGeometry.h" // Open3D visualization header file

using namespace std;

int main(int argc, char* argv[])
	// ---------------------LASLib reads the point cloud from the las file---------------------------
	LASreadOpener lasreadopener;
	LASreader* lasReader ="R.las");

	if (lasReader == 0)
		fprintf(stderr, "ERROR: could not open lasreader\n");

	printf("reading %I64d points from '%s'.\n", lasReader->npoints, lasreadopener.get_file_name());

	// ------------------------Open3D obtains point cloud coordinates------------------------------
	auto cloud = std::make_shared<open3d::geometry::PointCloud>();
	int pointAmount = lasReader->npoints; // Number of points in las
	int i = 0;
	while (lasReader->read_point() && i < pointAmount)
		cloud->points_[i][0] = lasReader->point.get_X();      // Get X coordinates of point cloud
		cloud->points_[i][1] = lasReader->point.get_Y();      // Get point cloud Y coordinates
		cloud->points_[i][2] = lasReader->point.get_Z();      // Obtain Z coordinates of point cloud

	// ------------------------Open3D display point cloud coordinates------------------------------
	open3d::visualization::DrawGeometries({ cloud }, "PointCloud", 800, 600);

	return 0;

6, Result display

reading 595018 points from 'R.las'.

Keywords: C++ github Computer Vision 3d

Added by QbertsBrother on Sun, 13 Feb 2022 12:37:09 +0200