Missing files, DirectX SDK (d3dx9.lib, d3dx9.h)

走远了吗. 提交于 2019-12-03 09:32:34

问题


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.


回答1:


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:

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.




回答2:


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




回答3:


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.




回答4:


in my case, following code works for me:

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

//#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "d3d9.lib")


来源:https://stackoverflow.com/questions/17015088/missing-files-directx-sdk-d3dx9-lib-d3dx9-h

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!