syntax error: identifier 'DXGI_RGBA in file dxgi1_2.h

浪子不回头ぞ 提交于 2019-12-08 01:20:05

问题


Trying to integrate the Directx toolkit into my game. I followed the steps here:

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

and everything went great. When trying to include one of the headers (SpriteFont.h) I get these errors:

I've refactored the project to 8.1 to match my game, and rebuilt the imported project and it works great. It's when rebuilding my project that I get these error.

(I've already made sure windows.h is being included before my directx headers.

Help!


回答1:


More than likely you are mixing the legacy DirectX SDK headers with the Windows 8.x SDK headers and mixing the old DXGI headers with new ones. As detailed on MSDN, if you want to mix the old DirectX SDK with the Windows 8.x SDK, you need to invert the traditional include path order.

Don't use this:

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

Use this:

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

There are also some #include tricks if you are using older stuff like D3DX headers which can implicitly pick up the old headers.

Ideally you should remove all use of the legacy DirectX SDK paths, but if you want to use XAudio on Windows 7 you need to continue to use it. See the wiki for details.




回答2:


you can probably try to #include "SpriteFont.h" in your .cpp file instead of your .h header file. I solved this problem in this way.



来源:https://stackoverflow.com/questions/38174893/syntax-error-identifier-dxgi-rgba-in-file-dxgi1-2-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!