chaosTechnician
chaosTechnician

Reputation: 1710

Cannot open include file "d3dx9.h"

Edit: Of course, immediately after working on it for an hour then posting here, I found the stupid mistake...

I'm getting compiler errors when trying to #include <d3dx9.h> in a project. I'm receiving "fatal error C1083: Cannot open include file: 'd3dx9.h': No such file or directory".

Any suggestions on what I'm forgetting or what else to try?

Thanks

Upvotes: 22

Views: 118507

Answers (5)

Niclas Lindstedt
Niclas Lindstedt

Reputation: 104

I tried all of these suggestions and none worked.

Turns out the $(DXSDK_DIR) variable doesn't work if you install DirectX while Visual Studio is still running. The solution for me was to restart Visual Studio (+ adding the paths in the solutions listed above, of course).

Upvotes: 1

Zsolt
Zsolt

Reputation: 582

Find the file on your computer, and add it's folder to the properties of your project.

Assuming you have visual studio: Properties/C/C++/General/Additional Include Libraries.

Upvotes: 4

dellos
dellos

Reputation: 367

you forgot one thing:

  1. Go to VC++ Directories -> Library Directories
  2. add $(DXSDK_DIR)LIB\x86
  3. apply.

Done. Hope this helps

Upvotes: 17

chaosTechnician
chaosTechnician

Reputation: 1710

I didn't realize that one of the other projects in the solution was #includeing a file that was #includeing a file that was #includeing d3dx9.h and I hadn't added those paths to that project.

/facepalm

Upvotes: 5

Liviu Mandras
Liviu Mandras

Reputation: 6627

You should make sure you have ALL paths sorounded by quotes ("). Instead of $(DXSDK_DIR)include you should have "$(DXSDK_DIR)include"

Upvotes: 8

Related Questions