语法错误 : identifier 'DXGI_RGBA in file dxgi1_2. h

标签 syntax directx toolkit

尝试将 Directx 工具包集成到我的游戏中。我按照这里的步骤操作:

https://github.com/Microsoft/DirectXTK/wiki/Adding-the-DirectX-Tool-Kit

一切都很顺利。当尝试包含 header 之一(SpriteFont.h)时,我收到这些错误 enter image description here :

我已将项目重构为 8.1 以匹配我的游戏,并重新构建了导入的项目,效果非常好。在重建我的项目时,我收到了这些错误。

(我已经确保 windows.h 包含在我的 directx header 之前。

救命!

最佳答案

您很可能将旧版 DirectX SDK header 与 Windows 8.x SDK header 混合,并将旧 DXGI header 与新 header 混合。详见 MSDN ,如果要将旧的 DirectX SDK 与 Windows 8.x SDK 混合使用,则需要反转传统的包含路径顺序。

不要使用这个:

<IncludePath>$(DXSDK_DIR)Include$(IncludePath);</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x86$(LibraryPath);</LibraryPath>
<LibraryPath>$(DXSDK_DIR)Lib\x64;$(LibraryPath);</LibraryPath>

使用这个:

<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64;</LibraryPath>

如果您使用诸如 D3DX header 之类的旧内容,那么还有一些 #include 技巧可以隐式获取旧 header 。

理想情况下,您应该删除所有旧 DirectX SDK 路径的使用,但如果您想在 Windows 7 上使用 XAudio,则需要继续使用它。请参阅wiki了解详情。

关于语法错误 : identifier 'DXGI_RGBA in file dxgi1_2. h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38174893/

相关文章:

c++ - DirectX11 阴影贴图问题

WPF 工具包未显示在工具箱中

c++ - (new Class())->Function(); 是什么意思?意思是?

c++ - C2259 错误 (directx 11)

c++ - 在 C++ 中分配给类型 char(不是 String)时如何转义字符

c++ - 在 Windows 上使用 DirectX 捕获屏幕

xcode-select - 使用 cli 工具包时切换路径

eclipse - 在 eclipse Neon 上安装 aws toolkit 时如何解决连接问题?

C中变量名后的冒号

java - --> 在 Java 中是什么意思?