d3dx11.h not in Windows 8.0 kit
Asked Answered
S

1

15

My development platform is windows 7 x64. I have installed VS2012 and I'd like to compile a project that includes some Dx11 code.

Specifically, it includes the following files:

#include <d3dx11.h>
#include <d3dx10.h>

and links to

#pragma comment (lib, "d3dx11.lib")
#pragma comment (lib, "d3dx10.lib")

I already have VS2011 installed on my development machine, but I wanted to try the unit testing facilities in VS2012 for native C++.

Due to having VS2011 installed and working on DirectShow code, I have the Windows 7.1 SDK installed.

VS2012 picked this up and had references to the 7.1 SDK, but compilation of my project under VS2012 with the 7.1 SDK referenced gave errors:

"warning C4005: '__useHeader' : macro redefinition"

I googled this and found a query like mine on social.msdn.microsoft.com. and the solution recommended linking with the Windows 8 kit instead of the 7.1 SDK in order to solve this problem.

The Windows 8 kit includes headers like d3d11.h, but not d3dx11.h.

How can I include d3dx11 (from the Dx SDK) along with the windows 8 kit, but without getting multiple "macro redefinition" errors?

Saleem answered 17/9, 2012 at 12:54 Comment(0)
S
17

I found the following rather annoying quote in this MSDN page.

D3DX is not considered the canonical API for using Direct3D in Windows 8 and therefore isn't included with the corresponding Windows SDK. Investigate alternate solutions for working with the Direct3D API.

For legacy projects, such as the Windows 7 (and earlier) DirectX SDK samples, the following steps are necessary to build applications with D3DX using the DirectX SDK:


Modify the project’s VC++ directories as follows to use the right order for SDK headers and libraries.

i. Open Properties for the project and select the VC++ Directories page.
ii. Select All Configurations and All Platforms.
iii. Set these directories as follows:

Executable Directories: (On right-side drop-down)

Include Directories: $(IncludePath);$(DXSDK_DIR)Include

Include Library Directories: $(LibraryPath);$(DXSDK_DIR)Lib\x86

iv. Click Apply.
v. Choose the x64 Platform. vi. Set the Library directory as follows:

Library Directories: $(LibraryPath);$(DXSDK_DIR)Lib\x64

Wherever "d3dx9.h", "d3dx10.h", or "d3dx11.h" are included in your project, be sure to explicitly include "d3d9.h", "d3d10.h" and "dxgi.h", or "d3d11.h" and "dxgi.h" first to ensure you are picking up the newer version.

You can disable warning C4005 if needed; however, this warning indicates you are using the older version of these headers.

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.

All D3DX DLLs are installed onto your development computer by the DirectX SDK installation. Ensure that the necessary D3DX dependencies are redistributed with any sample or with your application if it is moved to another machine.

Be aware that replacement technologies for current uses of D3DX11 include DirectXTex and DirectXTK. D3DXMath is replaced by DirectXMath.

FFS Microsoft, please don't change the API's mid-version like this!!!

Saleem answered 17/9, 2012 at 13:11 Comment(2)
Agreed, especially when all of the books currently out on DirectX11 make extensive use of d3dx11.h, madness!Lordling
See this blog postAllopathy

© 2022 - 2024 — McMap. All rights reserved.