Sign in to follow this  
Betastate

DirectX SDK strange bug

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


Link to post
Share on other sites
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


Link to 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


Link to post
Share on other sites
[quote name='Betastate' timestamp='1310744337' post='4835690']
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
[/quote]

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


Link to post
Share on other sites
I found [url="http://blogs.msdn.com/b/windowssdk/archive/2009/10/16/development-with-windows-sdk-directx-sdk-when-visual-studio-2008-is-installed.aspx"]this[/url] 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

Share this post


Link to 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


Link to 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


Link to post
Share on other sites
[quote name='Betastate' timestamp='1311088679' post='4837425']
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?!?!?!? :( :(
[/quote]

[url="http://takinginitiative.net/2010/07/02/setting-up-the-directx-sdk-with-visual-studio-2010/"]try reading this[/url]

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


Link to 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


Link to post
Share on other sites
Okey , I tried adding both lib dirs at the same time:

[attachment=4245:Exe1.jpg] [attachment=4246:Exe2.jpg] [attachment=4247:Include.jpg] [attachment=4248:Library.jpg]

I don't understand why the directories are linked with their exact path on top and a $(Directory) path at the bottom , but I guess that's how you do it :P I tried different configurations , including this , excluding that but it always gives me exactly the same error. Whenever I reinstall the SDK it does configure them in that manner , except I added a seperate path to the lib/x64. Stil no result... I am quite a noob so I put pictures of the exact configurations above in case I messed something up ^^. I am also fairly new to C++ , but even if I am to look for other tutorials for C# I am sure that I will need the SDK configured :)

Also if you think that it may help I can install VS2010 again and try configuring it there , though I don't see a major difference... but then again what do I know :P

Edit: I added the x64 directories in the Executable section as well , stil no result...

Share this post


Link to post
Share on other sites
did you read [url="http://takinginitiative.net/2010/07/02/setting-up-the-directx-sdk-with-visual-studio-2010/"]this[/url] ?
i hade some issues when i switched from VS2008 to VS2010.
but that sorted it out.
i can send a project file showing the correct settings and such, but please read [url="http://takinginitiative.net/2010/07/02/setting-up-the-directx-sdk-with-visual-studio-2010/"]this[/url] first :)

Share this post


Link to post
Share on other sites
Ok I reinstalled VS 2010 and followed the steppes showed in your link. I linked the paths and set the linker as shown:

[attachment=4254:VS2010Dirs.jpg] [attachment=4256:2010Linker.jpg]

Note that the d3dx9.h was already set as an additional dependency , so I had to do nothing there :) Stil getting the same error... "error LNK1104: cannot open file 'd3dx9.h'". Please send me your VS project at betastate@abv.bg or tell me what I'm missing :) I tried linking both the x64 and x86 lib files with the same effect...

Share this post


Link to post
Share on other sites
[quote name='Betastate' timestamp='1311161621' post='4837895']
Please send me your VS project at betastate@abv.bg
[/quote]
sent :)
note: you will need to change "Program Files (x86)" to "Program Files" (forgot to do this :D before sending), its in the path to the DX include and lib directorys.

include path:
C:\Program Files\Microsoft DirectX SDK (June 2010)\Include

lib path:
C:\Program Files\Microsoft DirectX SDK (June 2010)\Lib\x86

[quote name='Betastate' timestamp='1311161621' post='4837895']
or tell me what I'm missing :) I tried linking both the x64 and x86 lib files with the same effect...
[/quote]

did you link to d3d9.lib and d3dx9.lib ?

Share this post


Link to post
Share on other sites
You've been rly nice and all but that's not gonna fly... I rly don't understand what I need to do since I started your project and nothing changed about mine... guess I need to take a little break :( I don't know C++ well enough and learning DirectX is long enough of a shot , even if all was working well :) I study Computer Games Design so now I rly need to do more modelling , drawing , texturing , rigging , animating , some computer Games Porgamming in a more basic language such as C# and in 2D for a while if I want to put something nice together for real... I just rly wanted to set up a basic 3D Engine and learn what I need to do to import a Model in 3D space and also play premade animations of it...

I just have to chill the fuck out :D :D It's just I rly do understand how it all works in theory - however I lack the practise to start programming in DirectX... I'm a maniac and I want to understand ALL about game making... and I WLL , but not until another year at the Uni I'm afraid... :( :( Maybe it's all for the better - If I was to continue with DirectX i might have just lost all my visual brain power :D

Stil I'm kinda sad though... :( If you happen to find a noob-proof guide to setting up libraries in VS manually from scratch please post it :P :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this