DirectX SDK strange bug

Started by
15 comments, last by Betastate 12 years, 9 months ago
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 :(
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.
looks like your IDE (visual studio ?) does not know where the DX SDK files are ?

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

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

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.
Mike Popoloski | Journal | SlimDX
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 :P 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!!" :P :) , 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 :P
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.
"There is no secret ingredient.." - Po (Kung Fu Panda)
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?!?!?!? :( :(

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

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement