[Liblas-devel] Using CMake with gdal and GeoTIFF -> Visual Studio Build Error

Mateusz Loskot mateusz at loskot.net
Mon Mar 15 20:38:13 EDT 2010


Bellinski, Dan wrote:
> Hey Mateusz,
>
> I am using your CMake build with the latest libLAS code and running into
> a build error. I am linking libLAS with gdal 1.7.1 trunk and GeoTIFF
> 1.2.5 (linked with libTIFF 3.9.2). I have successfully built all the
> components (other than libLAS) and used the CMake files to create Visual
> Studio 2009 project files. All went well in the CMake generation with no
> error or warning. When I go to build from the generated VS project
> files, Las2ogr and las_c.dll are failing to build. The problematic
> output is listed below.
> 
>  
> I am unsure where to go with troubleshooting.. do you have any idea what
> the problem may be? I made sure my libraries were correct in CMake but
> maybe I am missing something? I have the following library/include
> variables set up and building in release mode:

Dan,

The CMake configuration was incomplete for Visual Studio.
I have updated it and tested with Visual C++ 10.0 (Beta)
Here are details of the update:

http://liblas.org/changeset/1620%3Ab1244e1f9b8b

I tested it with GDAL, libgeotiff and libtiff installed from OSGeo4W
packages.


> 3>las.lib(gt_citation.obj) : error LNK2001: unresolved external symbol
> __imp__strnicmp

As I noted in the commit comment linked above, this one is a mysterious
issue. This function comes from C run-time. However, there seems to be a
mysterious conflict with definitions in cpl_port.h (header of GDAL library).

The solution I found is to go edit GDAL header cpl_port.h

http://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_port.h?rev=17734#L294

and change line 294 and 295 and replace deprecated names with
recommended ones:

strnicmp with _strnicmp
and
stricmp with _stricmp

I have no idea what's going on here. I tried to specify MSVCRT.LIB
explicitly in liblas linker input(s) but it doesn't solve the problem.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the Liblas-devel mailing list