准備工作:
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