语法错误:文件dxgi1_2.h中的标识符'DXGI_RGBA

Scu*_*373 2 directx syntax toolkit

试图将Directx工具包集成到我的游戏中.我按照这里的步骤:

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

一切都很好.当试图包含其中一个标题(SpriteFont.h)时,我得到了这些错误在此输入图像描述:

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

(我已经确定在我的directx标题之前包含了windows.h.

救命!

Chu*_*urn 5

您很可能将传统的DirectX SDK标头与Windows 8.x SDK标头混合,并将旧的DXGI标头与新的标头混合在一起.如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>
Run Code Online (Sandbox Code Playgroud)

用这个:

<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64;</LibraryPath>
Run Code Online (Sandbox Code Playgroud)

#include如果你使用像D3DX头一样的旧东西可以隐含地拿起旧的标题,也有一些技巧.

理想情况下,您应该删除对旧版DirectX SDK路径的所有使用,但如果要在Windows 7上使用XAudio,则需要继续使用它.有关详细信息,请参阅维基.