DirectX11 deprecated headers

Nov 20, 2014 at 3:59 AM
Hello everyone I know it's not directx11 forum but some of you will probably know the answer. what it is I'm trying to follow some examples from "Beginning DirectX11 game programming" book but it's old a bit and I'm using windows 8.0 SDK that not include some of the headers that june2010 SDK have. for example d3dx11.h or DxErr.h any idea how to get that sorted? I know I can just download the SDK from june2010 but if there is newer version I wanna be able to write my apps over it. or maybe you know any good directX11 books for beginners that use the newer SDK ??
Coordinator
Nov 20, 2014 at 7:49 AM
Edited Nov 20, 2014 at 8:09 AM
In short: The Windows 8.x SDK replaces the DirectX SDK, and there is no newer version of the now legacy DirectX SDK than June 2010. D3DX11.h is missing because all versions of D3DX are now deprecated as well. Read Where is the DirectX SDK?, Where is the DirectX SDK (2013 Edition)?, and Where is the DirectX SDK? (MSDN).

Most of the books in print are a bit dated in this respect, and many still assume you are using the legacy DirectX SDK and the deprecated D3DX11 library. Ideally, you'd just adapt and learn to use Direct3D 11 without the older DirectX SDK only stuff. For that, read Living without D3DX which is a master table of replacements. DirectX Tool Kit is part of the story here for basic stuff like loading textures from DDS or other image files, sprite drawing, font drawing, basic primitives like spheres and boxes, etc. The DirectX Tool Kit doesn't use the legacy DirectX SDK at all and only requires the Windows 8.x SDK.

If you find that confusing and still want to use the legacy DirectX SDK stuff like D3DX, you can, but since you are using the Windows 8.x SDK (presumably with VS 2012 or VS 2013) as well, you will find some problems. The long-standing recommendation was to have the DirectX SDK include/lib paths first, then the Windows SDK/VS include/lib second. With the Windows 8.x SDK, you want the Windows 8.x SDK include/lib first, then the legacy DirectX SDK include/lib second. VS 2010, VS 2012, and VS 2013 do not automatically use the legacy DirectX SDK, and instead you have to setup the VC++ Directories settings accordingly. The MSDN link above includes information on modifying existing legacy DirectX SDK samples that build with VS 2010 to run with VS 2012/2013, plus a few other minor gotchas. The key thing to remember is that the DirectX SDK no longer contains the 'latest' versions of the headers and libraries, but it does have a few older headers/lib that are not part of the Windows 8.x SDK (i.e. D3DX11). This advice assumes you are writing Win32 desktop applications. For Windows Store apps, Windows phone 8 apps, or Xbox One apps, you can't use the legacy DirectX SDK at all. The good news here is that DirectX Tool Kit supports all these platforms as well.

For the most part, there's really only two reasons you would really need to use the legacy DirectX SDK in a newer application these days: Using XAudio on Windows 7 or earlier, and using XInput headset audio features (otherwise you are better off using XInput 9.1.0). See XAudio2 and Windows 8 and XINPUT and Windows 8. DirectX Tool Kit for Audio supports both using XAudio 2.8 for Windows 8 or later applications, as well as using the legacy DirectX SDK to get XAudio 2.7 for support for Windows Vista and Windows 7. DirectX Tool Kit's GamePad class uses XInput 9.1.0 so it can support Windows Vista or later and not require the legacy DirectX SDK at all.

While most of the headers and libraries, along with a few of the tools, from the DirectX SDK were moved forward to the Windows 8.x SDK, not all of them were. Also the Windows 8.x SDK no longer contains samples, and instead you are expected to find samples on MSDN Code Gallery. I've made some master lists of where to find the latest stuff: DirectX SDK Tools Catalog, DirectX SDK Samples Catalog.

Finally, a number of things that shipped in the legacy DirectX SDK were pretty dated to begin with. Here is a summary of the various technologies and their status: DirectX SDKs of a certain age and A Brief History of Windows SDKs.

Hope that helps!

PS: DxErr is also not in the Windows 8.x SDK, but if you want to use it you can find a newer version here.
Marked as answer by walbourn on 11/19/2014 at 11:49 PM
Nov 21, 2014 at 2:47 PM
Thanks that cleared everything. however I found better way than porting examples from book, what I'm doing is following theory from the book but I use code examples from microsoft site. thanks again !!
Coordinator
Nov 21, 2014 at 7:26 PM
Edited Nov 21, 2014 at 7:28 PM
Yes, the book samples are likely to be strongly tied to legacy DirectX SDK and older compiler releases. Using the samples from MSDN Code Gallery I link to above is best. The theory and API details are the same; it's just the supporting libraries that have changed w.r.t. to Win32 desktop applications.

Many of the same APIs also apply to programming Windows Store apps, Windows phone 8, and Xbox One as well, but the basic 'framework' of the swap chain, user-input handling, message loop, etc. are significantly different. I keep hoping to find time to make a Win32 desktop 'tutorial' template that looks a lot like the 'modern' platform templates to make this difference less profound for the purposes of learning Direct3D11 and DirectXTK...