d3dx11.h missing?
Asked Answered
M

3

23

So I've reinstalled directx11 a couple times and even went to the Microsoft website and got the SDK pack that has all the direct x cabinet files in it. Anyone have any idea why i keep getting this error then? I know why it is saying it but more looking for the solution to it.

1>c:\users\vaughn\documents\visual studio 2010\projects\myfirstapp\myfirstapp\main.cpp(5): fatal error C1083: Cannot open include file: 'd3dx11.h': No such file or directory

Midas answered 27/10, 2011 at 0:58 Comment(1)
Did you add the necessary folder into your include directories?Proverbs
T
33

That's what you need to do in VS 2010 (it looks a bit different in VS 2008 and earlier):

Go to your project's properties | Configuration Properties | VC++ Directories. Edit line called Include Directories by adding path to DirectX header files. As for June 2010 SDK it may be something like:

32 bit Win: C:\Program Files\Microsoft DirectX SDK (June 2010)\Include

64 bit Win: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include

Next you are most likely to get a linker's error (missing .lib files). Just go to your project's properties | Configuration Properties | VC++ Directories again, but this time edit Library Directories and add to one of the following paths:

32 bit Win: C:\Program Files\Microsoft DirectX SDK (June 2010)\Lib\x86

64 bit Win: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64

If you installed other version of SDK or installed it to non-default directory change given paths accordingly. Also make sure you added d3d11.lib (and maybe d3dx11.lib as well) to Linker | Additional Dependencies.

General rule is that any time you #include <> files your IDE needs to know where to find them. VC++ Directories is one way of doing that in Visual Studio. But sole inclusion of headers is (in most cases) not enough - you need to tell your linker where to look for precompiled binaries described by those headers. That what you do by adding the second path to Library Directories.

Trinatrinal answered 27/10, 2011 at 8:19 Comment(3)
Okay I'm going to go give this a try. I thought I did this because that is what the assignments instructions told me to do but I'll double check everything.Midas
Thanks for the help, turns out I was missing the VC++ directories and the linker libraries for Direct X11.Midas
What about using environment variable %DXSDK_DIR%/Include ?Lactalbumin
P
1

You have to make sure you get the latest DirectX SDK. It has the header files. If all you got were cabinet files, you got the wrong SDK.

Platonism answered 27/10, 2011 at 1:33 Comment(3)
I downloaded that and it still tells me that it is unable to find it? If I comment out the line requesting access to the file it works but then it makes me also comment out the d3dx10.h file as well and it loads fine.Midas
Can you search your system for d3dx*.h to see where the correct header files were installed to?Platonism
It didn't pop up even after reinstalling like 4 times.Midas
H
0

In my case, for DX12, I was missing d3dx12.h

See this MSDN page.

In case the page moves, the relevant line appears to be

"d3dx12.h is available separately from the Direct3D 12 headers. You can download d3dx12.h by navigating into any of the source files for the Direct3D 12 projects at GitHub/Microsoft/DirectX-Graphics-Samples"

Hitlerism answered 5/6, 2016 at 12:30 Comment(2)
The DirectX SDK is legacy, and D3DX9, D3DX10, and D3DX11 are deprecated. For a list of replacements, see Living without D3DX. D3DX12 is not part of the Windows SDK or the DirectX SDK. It's intended to just be copied into your project, it is provided on GitHub under the MIT license. It is also included in various DirectX 12 VS templates including these.Catheryncatheter
Note blob link is now hereCatheryncatheter

© 2022 - 2024 — McMap. All rights reserved.