Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

d3dx11.h missing?

Tags:

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

like image 285
Nicholas Vaughn Avatar asked Oct 27 '11 00:10

Nicholas Vaughn


1 Answers

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.

like image 51
Presto The Coder Avatar answered Sep 21 '22 15:09

Presto The Coder