vs2015编译gdal出错及解决方案

错误

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


原文地址: 原文地址



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值