首页 > 解决方案 > DirectX:空样本编译错误

问题描述

问候我正在尝试使用 Visual Studio 2017 构建 Direct3D 9 的空项目,该项目可在示例浏览器中找到。

我下载了整个项目文件并使用 VS2017 编译了项目,但在这一行出现了一个错误

严重性代码描述项目文件行抑制状态错误 C2668'abs':对重载函数 EmptyProject c:\users\myid\desktop\direct3d_source\emptyproject\dxut\core\dxutenum.cpp 的模糊调用 3975

代码如下

 float fCurRanking = abs( float( displayMode.RefreshRate.Numerator ) / fDenom1  -
                                         float( refreshRateMatch.Numerator ) / fDenom2 );

为了消除模棱两可的函数调用,我使用了转换运算符,例如 (int) 或 (long)。

(想使用 float 或 double cast 函数但会带来语法错误)

但我刚刚收到这些错误

严重性代码 描述 项目文件行抑制状态错误 LNK1120 1 未解析的外部 EmptyProject C:\Users\myid\Desktop\EmptyProject\Debug\EmptyProject.exe 1

错误 LNK2019 未解析的外部符号 __vsnwprintf 在函数“long __stdcall StringVPrintfWorkerW(unsigned short *,unsigned int,unsigned int *,unsigned short const *,char *)”中引用 (?StringVPrintfWorkerW@@YGJPAGIPAIPBGPAD@Z) EmptyProject C:\Users\myid \Desktop\EmptyProject\dxerr.lib(dxerrw.obj) 1

如何处理?我阅读了 LNK1120、LNK2019 页面,但不知道确切的错误在哪里

标签: c++directxdirectx-9

解决方案


推荐阅读