错误
使用vs2015编译gdal2.0.1时出现错误:
Creating library gdal_i.lib and object gdal_i.exp
odbccp32.lib(dllload.obj) : error LNK2019: unresolved external symbol _vsnwprintf_s referenced in function StringCchPrintfW
gdal201.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.EXE"' : return code '0x460'
Stop.
解决方法
方法一
在gdal2.0.1的解压包里面有一个nmake.opt文件,在内部找到如下内容:
!IFDEF ODBC_SUPPORTED
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ENDIF
然后替换成:
!IFDEF ODBC_SUPPORTED
!IF $(MSVC_VER) >= 1900
# legacy_stdio_definitions.lib : https://connect.microsoft.com/VisualStudio/feedback/details/1134693/vs-2015-ctp-5-c-vsnwprintf-s-and-other-functions-are-not-exported-in-appcrt140-dll-breaking-linkage-of-static-libraries
ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib
!ELSE
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ENDIF
!ENDIF
方法二
如果方法一没能解决,同时你又不需要使用ODBC的支持,在nmake.opt中,找到如下内容:
# Comment out the following to disable ODBC support.
ODBC_SUPPORTED = 1
然后替换成:
# Comment out the following to disable ODBC support.
# ODBC_SUPPORTED = 1
原文地址: 原文地址