VS2017 "macro redefinition" With DX11SDK

Started by
7 comments, last by MJP 6 years, 1 month ago

I've been away for a VERY long time, so if this topic has already been discussed, I couldn't find it.

I started using VS2017 recently and I keep getting warnings like this:


1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d10.h(609): warning C4005: 'D3D10_ERROR_FILE_NOT_FOUND': macro redefinition (compiling source file test.cpp)
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\shared\winerror.h(54103): note: see previous definition of 'D3D10_ERROR_FILE_NOT_FOUND' (compiling source file test.cpp)

It pops up for various things, but the reasons are all the same. Something is already defined.....

I have DXSDK June2010 and referencing the .lib and .h set correctly (otherwise I wouldn't get this, I'd get errors)

Is there a way to correct this issue or do I just have to live with it?

 

Also (a little off-topic) the compiler doesn't like to compile my code if I make very small changes.... What's up with that? Can I change it? Google is no help.

Advertisement

Do you really want to still be using the DXSDK from June 2010?

The Windows SDK (you have 16299.0) already has all the DirectX headers and libraries in it, so why not use that instead?

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

There are a number of functions, structs, classes, and macros that don't exist within the Windows SDK. Mostly the ones in xnamath....

There may be a way, but when I tried to remove the DXSDK reference, I got LOTS of errors.

XNAMath now lives under the name "DirectXMath", also in the Windows SDK. It should just be a drop-in replacement by-and-large.

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

Back when Windows 8 came out, DirectX stopped being shipped as a separate SDK and was pulled into the core Windows SDK. This means that you can possibly include two different versions of the same D3D header (which is exactly what's causing your error message). To avoid this you need to be very careful about how you include the D3D files, and you will probably also need to make sure that the legacy DX SDK is listed *before* the Windows SDK in Visual C++'s include directories. There's some information on MSDN about how to get this to work properly. This blog also has useful information about the legacy DX SDK and what its been replaced with, and also has an article that's geared towards helping you move away from D3DX so that you can drop the dependency on the old SDK,

I'm currently using VS, but would the windows SDK work if I used a different compiler?

HOLY CRAP! I have to change a lot of stuff just to make this work.

Yeah, it's unfortunate that there was such a breaking change. It's especially unfortunate that there's still a lot of existing sample code, tutorials, and even books out there that depend on the deprecated D3DX helper libraries. We all went through this same pain 6 or 7 years ago. :(

On the upside, D3DX has been completely replaced with open-source alternatives, which is much better option in the long run. 

This topic is closed to new replies.

Advertisement