Error LNK2019 unresolved external symbol __vsnprintf … (in dxerr.lib)
1>------ 已启动生成: 项目: XuglassForm, 配置: Debug Win32 ------ 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(1188,5): warning MSB8012: TargetPath(C:\Users\hxy-pc\Desktop\XuglassForm\Debug\XuglassForm.exe) does not match the Linker's OutputFile property
value (). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). 1>odbccp32.lib(dllload.obj) : error LNK2019: 无法解析的外部符号 __vsnwprintf_s，该符号在函数 _StringCchPrintfW 中被引用 1>XuglassForm.exe : fatal error LNK1120: 1 个无法解析的外部命令 ========== 生成: 成功 0 个，失败 1 个，最新 0 个，跳过 0 个 ==========
The legacy DirectX SDK is quite old, and dxerr.lib in the DXSDK is not compatible
with VS 2015's C Runtime as you have encountered.
In general static libraries with code in them don't mix well from different versions of the compiler. Most of the .libs in the legacy DirectX SDK work with VS 2015 because they are import libraries for dlls or all
data libraries and therefore contain no code at all. The DXSDK has not been updated since VS 2010.
Be sure to read the instructions on MSDN on
the proper way to mix the legacy DirectX SDK with the Windows 8.x SDK used by VS 2015. You are presumably using something else from the legacy DirectX SDK in this project besides dxerr.
I have implemented a version of DXERR that you can build from source in your project to remove this dependacy of the legacy DirectX SDK. See this
post for details. That said, I purposely only supported Unicode (the W version). You can work out how to make the ANSI (the A version) easily enough, but it would be best if updated your app to use Unicode.
You can change the Platform Toolset from Visual Studio 2015 to Visual Studio 2013 and then it compiles. The Platform Toolset is found on the General
tab of the Project Properties.
可以从Visual Studio 2015改变平台工具集到Visual Studio 2013，然后它编译
The DirectX libraries you are using are compiled with an older version of Visual Studio than you are using. Microsoft sometimes makes changes to
their C runtime, creating incompatibilities between libraries compiled with different versions. __vsnprintf was an internal
symbol in older versions of their C runtime, it does not exist in the 2015 RC version.
Unfortunately, dxerr.lib (along with d3dx11.lib) have been deprecated.
You have two options - you can switch back to VS2013 or you can stop using functionality from dxerr.lib. The latter is probably better, because you can duplicate its functionality by using FormatMessage now
(more info in the linked article).
I experienced the same problem using DXGetErrorMessage() with Dx9 and
found out that MS have provided an additional library to include in the Additional Dependencies properties page to address
this problem. The library name is: legacy_stdio_definitions.lib