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

tang tang312 at gmail.com
Wed Aug 31 08:44:11 EDT 2011


 It seems that gdal always links it's applications to dynamic lib. at last I
change the makefile.vc in the app folder with below lines.
!IFDEF DLLBUILD
LIBS = $(GDAL_ROOT)\gdal_i.lib
!ELSE
LIBS = $(GDAL_ROOT)\gdal.lib $(GDAL_ROOT)\ogr\ogr.lib
$(GDAL_ROOT)\port\cpl.lib $(GDAL_ROOT)\ogr\ogrsf_frmts\ogrsf_frmts.lib
$(ODBCLIB) $(CURL_LIB) $(TIFF_LIB) $(JPEG_LIB) $(PNG_LIB) $(GEOS_LIB)
!ENDIF
then the applications can run with out gdal18.dll.
  Best regards!  and thank you !

On Wed, Aug 31, 2011 at 2:46 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

> 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!
>>
>
> Tang,
>
> 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
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110831/90c42418/attachment.html


More information about the gdal-dev mailing list