For the overall compilation gdal, please refer to the spicy GIS. But this blog post is compiled by VS2010 x86. If you need to compile a 64-bit or other vs version of the program, refer to the following. Error One: failure during conversion to COFF: invalid or corrupt file
Reference: Cvtres Solutions
Solution:
You can resolve this issue by modifying whether to embed the manifest in vs. However, this variable cannot be modified when compiling gdal with CMake.
Therefore, you can only search all the Cvtres.exe in the system first, then overwrite the corresponding cvtres in the Vc/bin directory to make the version consistent.
* * Error Two: 64-bit Gdal compilation
64-bit programs are already very popular, so we also need to compile the 64-bit version of the program. In addition to using the VS 64-bit console, you need to modify the nmake.opt under the folder as follows:
# Uncomment the following if you is building for 64-bit Windows
# (x64). You'll need to has the PATH, INCLUDE and LIB set up for 64-bit
# compiles.
#WIN64 =yes
# Capture Win64=1 if specified in NMAKE command line
! ifdef WIN64
win64=yes
! ENDIF
Modify the following:
# Uncomment the following if you is building for 64-bit Windows
# (x64). You'll need to has the PATH, INCLUDE and LIB set up for 64-bit
# compiles.
Win64=yes
# Capture Win64=1 if specified in NMAKE command line
! ifdef WIN64
win64=yes
! ENDIF
error Three: VS2015 compiled Gdal
By default, if you do not specify the VS version, Gdal compiles the code using VS2008, so you also need to modify the Nmake.opt file manually to modify it as follows:
###############################################################################
# Check version of Visual C + + Compiler:
# nmake-f MAKEFILE.VC msvc_ver=xxxx
# where xxxx is one of following:
# 1910 = 15.0 ()
# 1900 = 14.0
# 1800 = 12.0 (+) #
1700 = 11.0 (+) # = 10.0 (in)
# = 9.0 (+)
# 1400 = 8.0 (2005)-specific compilation flags, different from older VC
# 1310 = 7.1 (2003) # Is it still Suppo RTed?
# 1300 = 7.0 (2002) # Is it still supported?
#
! ifndef msvc_ver
#assume MSVC VS2008.
msvc_ver=1500
! ENDIF
Depending on the VS version you are using, select the corresponding number to fill in. In my example is VS2015, then fill in 1900.
###############################################################################
# Check version of Visual C + + Compiler:
# nmake-f MAKEFILE.VC msvc_ver=xxxx
# where xxxx is one of following:
# 1910 = 15.0 ($)
# 190 0 = 14.0
# 1800 = 12.0 (+) #
1700 = 11.0 (+) # = 10.0 (in)
# = 9.0 ($) #
1400 = 8.0 (2005)-specific compilation flags, different from older VC
# 1310 = 7.1 (2003) # Is it still supported?
# 1300 = 7.0 (2002) # Is it still supported?
#
! ifndef msvc_ver
msvc_ver=1900
! ENDIF