Missing files, DirectX SDK (d3dx9.lib, d3dx9.h)
Asked Answered
P

4

15

I installed the DirectX SDK June 10, but when I include the d3dx9.h, the compiler can't find it.

I checked the SDK directory, and I didn't find it there either.

files missing: d3dx9.lib, d3dx9.h, dxfile.h.

Poundfoolish answered 9/6, 2013 at 23:13 Comment(5)
where did you get the SDK? Where did you install it? can you paste the full path of the folder you checked? have you try reinstall?Geniality
I get it from Microsoft's webpage, this is the path "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A", I tried to reinstall, but still it doesn't install those filesPoundfoolish
i found the files, i was looking at the wrong path, but now i noticed that there is not the d3dx9.dll anywhere, i downloaded it from internet, but it seems to be corrupted...Poundfoolish
the dlls was not in DirectX SDK installation folder, they are in the system folder, for example C:/windows/system32/Geniality
Starting with VS 2010, the legacy DirectX SDK does not automatically get referenced by a project when it is installed. You have to add the include/lib paths to the VC++ Directories property sheet as is discussed in the DirectX SDK documentation. When using the legacy DirectX SDK with the Windows 7.x SDK, you should put the DXSDK include/lib paths first, then the Windows 7.x SDK. However, since the DXSDK is now outdated when using it with the Windows 8.x SDK, you should put the Windows 8.x SDK include/lib paths first and then the legacy DirectX SDK if you need it.Bank
C
18

The DirectX SDK installation will add a system environment variable DXSDK_DIR that holds the path to wherever the SDK was installed to. Instead of inserting an absolute path in your Include and Library Directories, I'd recommend using this variable to set the Include and Library path for DX dependencies.

As Include Directory add: $(DXSDK_DIR)Include

As Library Directory add: $(DXSDK_DIR)Lib\x86 or $(DXSDK_DIR)Lib\x64 on a 64-bit architecture

So your VC++ Directories should look something like this: DX Include Directories

The $(DXSDK_DIR) resolves to the path where you installed the SDK, normally "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)" and works even if you chose another path, which makes it more available between different people.

Corriveau answered 7/3, 2017 at 17:29 Comment(0)
L
8

The library file (d3dx9.lib) should be in C:\path\to\Microsoft DirectX SDK (June 2010)\Lib\x86\ as well as in C:\path\to\Microsoft DirectX SDK (June 2010)\Lib\x64\

Both include files you mentioned exist in C:\path\to\Microsoft DirectX SDK (June 2010)\Include\

If you're still not able to find them, download and install the SDK from here: http://www.microsoft.com/en-us/download/details.aspx?id=6812

I downloaded and used this one and I can asure you, that those files are present!!

Lindalindahl answered 12/6, 2013 at 22:19 Comment(2)
Should I use the x64 folder if I use 64 bit operation system or there is no difference?Belch
Depends on where your program should run... If you use x64 then it won't run on x32 processors. I personally allways use x32 for compatibility with more systems.Lindalindahl
S
2

When I had this problem, I found that I had the d3dx9.h in the
[Program Files(x86) \ Microsoft DirectX SDK (June 2010) \ include] folder.
The compiler needed it to be in
[Program Files(x86) \ Windows Kits \ 8.1 \ include \ shared].
I copied the file to the other location and it worked, but I wonder if that was the smartest fix.

Standoff answered 19/2, 2015 at 22:16 Comment(1)
If using the legacy DirectX SDK in combination with the Windows 8.x SDK, you need to set up the VC++ directories so that the Windows SDK include path is used first, then the DirectX SDK. See MSDNBank
C
1

in my case, following code works for me:

//#include <d3dx9.h>
#include <d3d9.h>

//#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "d3d9.lib")
Causalgia answered 10/1, 2018 at 2:20 Comment(1)
This is due to DirectX 9's inclusion in the Windows SDK starting from (I believe) version 8.1 or 7.0. If you've installed the DirectX 9 SDK explicitly, you're not using it by just including and referencing the d3d9 files. This will include and link against the Windows SDK, not the DirectX SDK, unless you change include and library directory order so Direct X SDK files are taken first. I've had issues with the Direct X files included in the Windows SDK, I believe they were not as up-to-date as the ones in the Direct X SDK. Also if you're using any extension methods (d3dx9), this won't work.Corriveau

© 2022 - 2024 — McMap. All rights reserved.