preparatory work:
SOURCE download, download the corresponding Gdal version here
Https://trac.osgeo.org/gdal/wiki/DownloadSource
Lazy compile can also download the corresponding version here
Https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
http://www.gisinternals.com/release.php
Compile process:
Taking VS2012 as an example
Win32
1, open VS2012 x86 native tool command prompt; Start Menu->microsoft Visual Studio 2012->visual Studio tools->vs2012 x86 native Tools command Prompt
2. Set to Gdal resource directory by CD command line command
3. After setting to the Gdal directory, type the following command line
nmake/f MAKEFILE.VC
nmake/f MAKEFILE.VC Install
nmake/f MAKEFILE.VC Devinstall
The version file is then generated under C:\warmerda.
X64
64-bit version, Ink:error LNK2001 link error appears.
The following should be noted:
1, open VS2012 x64 compatible tool command prompt; Start Menu->microsoft Visual Studio 2012->visual Studio tools->vs2012 x64 Compatibility tool command Prompt
2. After setting to the Gdal directory, add msvc_ver=1700 WIN64 = YES after the command line to type the following command
nmake/f makefile.vc Install msvc_ver=1700 Win64=yes
nmake/f makefile.vc Devinstall msvc_ver=1700 win64=yes
where Msvc_ver and VS versions are related
# 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
Reference: Https://trac.osgeo.org/gdal/wiki/BuildingOnWindows
GDAL2.0 Compilation--32-bit and 64-bit