尝试将 Directx 工具包集成到我的游戏中。我按照这里的步骤操作:
https://github.com/Microsoft/DirectXTK/wiki/Adding-the-DirectX-Tool-Kit
一切都很顺利。当尝试包含 header 之一(SpriteFont.h)时,我收到这些错误 :
我已将项目重构为 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/