Greetings LAStools enthusiasts!
I've looked around and noticed people struggling to compile LASlib with MSVC2010, in Visual Studio 2010. I thought I'd give some detailed instructions for what I did with some help from this group's archives.
I began by opening the laslib.dsw and allowing Visual Studio 2010 to convert it to a new solution file. I then made the following changes to the LASlib source code:
- Commented out lines 56-60 of mydefs.hpp to remove the typedef of BOOL. (might break backwards-compatibility, but I don't care).
- Replaced all instances of BOOL with bool in all files in /src and /inc.
- Rename or delete the "stl" directory.
Required for my build - your mileage may vary:
- Set up the project for 64bit compile.
- Open Build --> Configuration Manager.
- Selecting "<New...>" under "Active solution platform", set the name of the new platform to "X64", and copy settings from Win32.
- Close the Configuration Manager.
- Change the Runtime Library to DLL.
- Right-click on the LASlib project, Properties.
- On the top, select the Debug configuration and the new x64 platform.
- Navigate to Configuration Properties --> C/C++ --> Code Generation
- Change Runtime Library to "Multi-threaded Debug DLL (/MDd)"
- Now select the Release configuration and the new x64 platform.
- Change its Runtime Library to "Multi-threaded DLL (/MD)"
- Save all changes.
Rebuild the laslib project, ignoring the massive number of warnings. Most of these are MSVC2010 whining to coerce you into using their specialized "secure" functions. If you use those functions to make MSVC2010 happy, though, you'll eliminate cross-platform (linux) support. Other warnings are related to Martin's various conversions of variables of type
int,
bool, and
size_t. I opted not to go through and correct these since it was a hassle and might have unforeseen consequences if I wasn't paying attention.
Note that I have not built the example, the laszippertest, or the laszip projects. The laszip project failed to convert at all, but as far as I can tell, that code is included with LASlib anyway.
When connecting to LASlib in your project, simply add the new LASlib.lib libraries from the "lib" (release) and "libD" (debug) folders to your project and #include the appropriate headers in the "inc" directory. I did this in Qt Creator for my 64bit Qt-based project.
I've successfully read LAZ files using this new library. I haven't noticed any issues after the conversion to a 64bit library, but that doesn't mean there aren't any, especially given Martin's fancy bit twiddling.
I'm no software expert, but that's how I did it. Everything was done using the March 15, 2013 download of LASlib.
Good luck!
Evon
--
Evon Silvia Geomatics Engineer
WSI Corvallis, OR WSI Portland, OR WSI Oakland, CA
517 SW 2nd St., Suite 400, Corvallis, OR 97333