-2

I know there are many post on macro redefinition issues but I still cannot understand how the reorder fix the problem.

When my project has includes in this order in VC++ Directories->Include Directories like shown in here
and in C/C++ -> General -> Additional Include Directories like shown here
I get macro redefinition warning:

1>c:***************************************\directx\dxgitype.h(12): warning C4005: 'DXGI_STATUS_OCCLUDED' : macro redefinition (############.cpp)
1>          C:\Program Files (x86)\Windows Kits\8.0\Include\shared\winerror.h(49449) : see previous definition of 'DXGI_STATUS_OCCLUDED'

But, when I remove $(SolutionDir)\common\ExternalLibs\directx from Additional Include Directories and move it to VC++ Directories->Include Directories the warning disappears.

I checked both winerror.h and dxgitype.h and I didn't see #undef DXGI_STATUS_OCCLUDED. So, how the reorder fixed the warning? At least one of the header should have #undef in order to allow it to be defined in other header, right? Also, Additional Include Directories are loaded after Include Directories or what?

  • Don't include links to images containing _relevant_ information about your problem, it's useless to other community members if it ends up becoming a dead link (which is common). **Edit** your post and include it there. – Captain Obvlious Dec 13 '14 at 00:19
  • @CaptainObvlious, first of all I couldn't post the images HERE. When I tried the system said that I need reputation over 10 in order to post images! Secondly, the links are not dead! So, why you voted down?? – interested Dec 13 '14 at 03:51
  • Then copy and paste the contents of the includes directory configuration fields with a description of what they are and which fields they originate from. FWIW the images you provided are incomplete and don't show all of the include directories configured in Visual Studio. – Captain Obvlious Dec 13 '14 at 14:04

1 Answers1

0

What's in $(SolutionDir)\common\ExternalLibs\directx? I suspect it has a copy of the legacy DirectX SDK headers which means you are mixing old DirectX SDK headers with new Windows 8.0 SDK headers. The error you are seeing is specifically mentioned on MSDN:

c. Remove all references to DXGIType.h in your project. This header doesn't exist in the Windows SDK, and the DirectX SDK version conflicts with the new winerror.h.

Ideally you'd just stop using the legacy DirectX SDK, which if you remove that folder and it still builds, then you should do that.

Otherwise, mixing the legacy DirectX SDK with the Windows 8.x SDK is covered on MSDN. Basically you have to put the DirectX SDK include/lib paths after the Windows 8.x SDK include/lib paths.

See Where is the DirectX SDK blog post as well.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81