Macro definition clash between directx headers and winerror.h

キキジキ picture キキジキ · Sep 30, 2012 · Viewed 13.3k times · Source

I'm on windows 7 using Visual Studio 2012.

When I compile I get a lot of macro redefinition warnings caused by winerror.h versus dxgi.h, dxgitype.h, d3d11.h, d3d10.h; for example DXGI_STATUS_OCCLUDED, DXGI_STATUS_CLIPPED, DXGI_STATUS_NO_REDIRECTION etc.

I suppose this is because the windows sdk 8 is installed. How can I avoid this? Is there a way I can exclude these new libraries from my project?

Answer

gradbot picture gradbot · Oct 15, 2012

I ran into this issue compiling SlimDX with Visual Studios 2012 on Windows 8. Windows SDK includes are inherited by default so they load after manually defined project include directories. To fix it add the Windows SDK as the first include directory. $(WindowsSDK_IncludePath)