[gdal-dev] question about build static gdal with visual studio

Frank Warmerdam warmerdam at pobox.com
Wed Aug 31 02:46:25 EDT 2011

On 11-08-30 06:58 PM, tang wrote:
> Thanks a lot for your replay!
>      I got the gdal.lib,but while I link the program to this lib,it still needs
> gdal18.dll. this confused me . I had tried to   comment out   DLLBUILD=1  ,
> but the commandline programs need   gdal18.dll too.   even replacing all
> gdal_i.lib with gdal.lib helps nothing.
>      I know little about  nmake/cl/link, whitch are used in  the gdal's  vs
> slution.  It seems in linux configure we can build static gdal with
> --enalbe-static,but I don‘t know how to do this in VS nmake.
>       Best regards!  and thank you again!


Well, it took me a while, but I did a default build with MSVC2008 Express
on windows with GDAL 1.8.1 and then issued this command from within the

cl /MD apps/gdalinfo.c gdal.lib /Ilib /Igcore /Iport /Ialg /Iogr /Iogr/ogrsf_frmts

This produced a 4MB gdalinfo.exe (statically linked) that works fine.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list