我正在使用 MSVC 2015 64 位命令提示符从源代码构建 GDAL。我使用的是 Windows 8。在构建过程中,我收到以下错误:
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 最终版本之前得到解决。
- https://github.com/mapbox/windows-builds/issues/53 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-打破静态库的链接 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)。有没有人有幸使用 MSVC 2015(64 位)构建 GDAL?
GDAL-2.1.0 已经在 nmake.opt 上进行了类似的更改
!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
但您还必须使用参数 MSVC_VER 从命令行指定 Visual Studio 版本。
例如对于 Visual Studio 2015 (MSVC_VER==1900) 使用此命令行进行编译
nmake -f makefile.vc MSVC_VER=1900
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)