Jump to content
• Advertisement

# DirectX SDK strange bug

This topic is 2557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi , I'm quite new to C++ , but I decided to start ZophusX's DirectX tutorials >> http://zophusx.byethost11.com/main.php . I am more or less following , but I am now stuck at tutorial 8 where the "d3dx9.h" is introduced. For some reason it yelds a "fatal error LNK1104: cannot open file "d3dx9.h". I have installed the latest DirectX SDK from the Microsoft website (June 2010) , and I believe it is properly configured for my Visual Studio 2008. It does read the "d3d9.h" file and everything complies ok , just for some reason fails to open the other library.

Please help me resolve this as I was just becoming quite exited about drawing objects in actual 3d space when I failed to run the code

#### Share this post

##### Share on other sites
Advertisement
Make sure you added [source "c++"]#pragma comment(lib, "d3dx9.lib") [/source] after your other #include's.

I also add d3dx9.lib to the project's dependencies. I don't know other IDE's, but if you're using VisualStudio, you right-click the project name in the Solution Explorer and open Properties. Under Linker > Input, just add that file name to Additional Dependencies.

Still being fairly new I don't understand all of this fully, but I think the two things I suggested are redundant. I'm just in the habit of doing both from past projects, and it doesn't seem to have had any negative effects.

Edit: Another problem I ran into early was in setting up the includes in the VS options, for the lib I gave the path to the SDK/lib folder, but did not specify x64 or x86. After some linkage problems, I pointed it to the inner folder of x86 which fixed it, because it did not automatically search subfolders.

#### Share this post

##### Share on other sites
looks like your IDE (visual studio ?) does not know where the DX SDK files are ?

#### Share this post

##### Share on other sites
I have indeed included it properly as the other one , this is the code :

[attachment=4168:Library Error.jpg]

And these are the folders that are included:

[attachment=4169:Library Error2.png]

I installed Visual Studio 2010 , which made even the d3d9.h file impossible to find in VS2008 for some reason. I uninstalled it , and this is the error I'm getting now. I did not reinstall the SDK after I removed VS2010 , but everything is stil working nice with the d3d9.h . Do I need to do some stuff to link my SDK properly or what? I've read somewhere that d3d9.h is included with VS2008 , so maybe I stil need to do something more? Please help!

Thank you

#### Share this post

##### Share on other sites

I have indeed included it properly as the other one , this is the code :

[attachment=4168:Library Error.jpg]

And these are the folders that are included:

[attachment=4169:Library Error2.png]

I installed Visual Studio 2010 , which made even the d3d9.h file impossible to find in VS2008 for some reason. I uninstalled it , and this is the error I'm getting now. I did not reinstall the SDK after I removed VS2010 , but everything is stil working nice with the d3d9.h . Do I need to do some stuff to link my SDK properly or what? I've read somewhere that d3d9.h is included with VS2008 , so maybe I stil need to do something more? Please help!

Thank you

You show the directories for Executable Files. There are a separate set of paths for includes, and yet another for libraries. You should add the appropriate paths to them. Also notice that there is a completely different set of paths for each solution platform; if you're compiling for something other than Win32 (x86), you'll have to set those other paths as well.

#### Share this post

##### Share on other sites
I found this website that tells you how to set it up , indeed for Win32. I did everything and it still doesen't help. I moved everything to the bottom as stated there and set the right links everywhere. The error remains... I tried including everything everywhere but that always gave me a "corrupt file" error which makes sense but... dunno , stil fails to load the library

P.S. Nothing on this PC is licenced , so that might be a problem I am fairly new to programming and I don't want to pay for something I'm gonna end up not using , nor do I want to try something out without having a full access of all functions. So... "agrr matey!!" , anyway I downloaded the SDK from the Microsoft website and it didn't say anything about my Visual Studio or Windows not being genuine (I don't even know if my windows is genuine as it comes with my laptop , It does automaticly update , but knowing the practices of computer companies in my country it might be a pirated copy...) . As I study Computer Games Design I am entitled to a free Windows 7 and a student version of Visual Studio , I just can't be asked to go get as I know very well how to find what I need on the internet

#### Share this post

##### Share on other sites
for the lib, try linking to ..\Lib\x86 instead of just \Lib.

I was able to recreate your issued in VS2010 with d3dx10.lib. In the VC++ directories->Library Directories I changed mine to $(DXSDK_DIR)Lib then restarted VS and got the linking error. I changed it back to what i had,$(DXSDK_DIR)Lib\x86 and it worked fine.

#### Share this post

##### Share on other sites
Same old error... Gonna get down to learning some simpler C++ until someone helps me out... It does appear to automaticly get configured , why can't it open the file?!?!?!?

#### Share this post

##### Share on other sites

Same old error... Gonna get down to learning some simpler C++ until someone helps me out... It does appear to automaticly get configured , why can't it open the file?!?!?!?

try reading this

basically it says

in the directorys node of your projects 'properties page' 'Include Directories' should point to:
"C:\Program Files\Microsoft DirectX SDK (June 2010)\Include"

and the 'Library Directories' should poin to:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
respectively for 32 and 64 bit builds.

let me know if it works

#### Share this post

##### Share on other sites
You're definitely not configuring the locations for the DXSDK correctly, and the reason why d3d9.h works despite that is that d3d9.h (and d3d9.lib) are included in the standard SDKs, but the d3dx9 stuff isn't.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5
• Advertisement

• 14
• 19
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631761
• Total Posts
3002178
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!