Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

d3dx11.h not in Windows 8.0 kit

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?

like image 245
fishfood Avatar asked Sep 17 '12 12:09

fishfood


People also ask

Does Windows SDK include DirectX?

DirectX is now a fundamental part of Windows. Because the Windows SDK is the primary developer SDK for Windows, DirectX is now included in it. You can now use the Windows SDK to build great games for Windows.

Where is Dxsdk?

By default, the Windows 10 SDK is installed into the "C:\Program Files (x86)\Windows Kits\10" folder.

What is DirectX SDK?

DirectX SDK is the key multimedia handler on Microsoft-based computers, game consoles or smartphones. It consists of various APIs such as Direct3D, DirectDraw, DirectPlay, DirectSound or DirectMusic. All of which manage the connections between software and hardware.


1 Answers

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!!!

like image 100
fishfood Avatar answered Sep 23 '22 19:09

fishfood