GDAL2.0编译——32位和64位

准备工作:

Source下载,这里下载对应的GDAL版本

  https://trac.osgeo.org/gdal/wiki/DownloadSource

懒得编译也可以在这里下载对应版本

  https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries

  http://www.gisinternals.com/release.php 下载地址

编译过程:

VS2012为例

 Win32

  1、打开 VS2012 x86 本机工具命令提示; 开始菜单->Microsoft Visual Studio 2012->Visual Studio Tools->VS2012 x86 本机工具命令提示

  2、通过cd 命令行命令 设置到GDAL资源目录

  3、设置到GDAL目录后,以此键入如下命令行

      
     nmake /f makefile.vc
    nmake /f makefile.vc install    
     nmake /f makefile.vc devinstall
      然后C:warmerda下会生成版本文件。

 

 X64

  64位版本,会出现INK : error LNK2001链接错误。

  需注意如下:

  1、打开 VS2012 x64 兼容工具命令提示; 开始菜单->Microsoft Visual Studio 2012->Visual Studio Tools->VS2012 x64 兼容工具命令提示

  2、设置到GDAL目录后,命令行后加入 MSVC_VER=1700 WIN64=YES,以此键入如下命令

     nmake /f makefile.vc MSVC_VER=1700 WIN64=YES 
      nmake /f makefile.vc install MSVC_VER=1700 WIN64=YES
     nmake /f makefile.vc devinstall MSVC_VER=1700 WIN64=YES
   
    其中 MSVC_VER 和VS版本关系如下

    # nmake -f makefile.vc MSVC_VER=xxxx
    # where xxxx is one of following:
    # 1900 = 14.0(2015)
    # 1800 = 12.0(2013)
    # 1700 = 11.0(2012)
    # 1600 = 10.0(2010)
    # 1500 = 9.0 (2008)
    # 1400 = 8.0 (2005) 
    # 1310 = 7.1 (2003)
    # 1300 = 7.0 (2002)
    # 1200 = 6.0

参考:https://trac.osgeo.org/gdal/wiki/BuildingOnWindows

原文地址:https://www.cnblogs.com/geospatial/p/5634033.html