您的位置:首页 > 其它

vs2015编译gdal出错及解决方案

2015-12-31 10:42 731 查看


错误

使用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


原文地址:原文地址
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: