链接器错误构建GDAL [英] Linker Error Building GDAL
问题描述
我正在使用MSVC 2015 64位命令提示符从源代码构建GDAL.我正在使用Windows8.在整个构建过程中,出现以下错误:
I am building GDAL from source using the MSVC 2015 64-bit command prompt. I am using Windows 8. Part way through the build, I get the following error:
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.
我已经在Microsoft网站和GDAL Git问题部分中阅读到,这是2014 MSVC和MSVC 2015的预发行版本的问题,但是应该在MSVC 2015的最终版本之前解决此问题.
I have read on the Microsoft Site and GDAL Git issues section that this was a problem with the 2014 MSVC and pre-release version of MSVC 2015, but the issue was supposed to be resolved prior to the final release of MSVC 2015.
- https://github.com/mapbox/windows-builds/issues/53
- 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
我似乎不是唯一遇到此问题的人,但是我也没有看到解决方案(除了恢复到旧版本的MSVC(例如2013)之外).有人有运气让GDAL使用MSVC 2015(64位)进行构建吗?
I don't seem to be the only person with this issue, but I am also not seeing a solution (besides reverting to an older version of MSVC such as 2013). Has anybody had any luck getting GDAL to build using MSVC 2015 (64 bit)?
推荐答案
我编辑了nmake.opt:
I edited nmake.opt:
我替换了667行...:
I replaced line 667 ... :
!IFDEF ODBC_SUPPORTED
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ENDIF
具有:
!IFDEF ODBC_SUPPORTED
!IF $(MSVC_VER) < 1900
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ELSE
ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib
!ENDIF
!ENDIF
/安德斯
这篇关于链接器错误构建GDAL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!