compiling directx 9 problems

Started by
19 comments, last by Mattijs2 15 years, 5 months ago
I am a complete beginner to directx and just got a new compiler( my first ever) Visual c++ express edition. I asked my question on the msdn forums but they sometimes don't answer so i was hoping someone here would know. I ahve a a directx 9.0 book in it there are lots of examples to compile. The book was made for two specfic compilers visualc++ 6.0 or visual c++.net I am not using either so it is confusing since there are certain files you have to include depending on what compiler you use. In one example called Dolphin I include the main.cpp the resource.h and winmain.rc I get an error that says can't find D3DX9.h when i add that i still get the same error What i am asking is what exactly are the files i have to add? I know it sounds dumb but i must be missing something. Also according to the readme file there are two .vsh files but those files are in another directory, who knows why. do i add those? Hopefully this will make sense to someone 3dmodeler
http://digitalart.f-sw.com
Advertisement
Have you downloaded the latest DirectX SDK? If not try that you can get it here: DirectX August 2008 SDK
Yeah, make sure you ahve the latest DirectX SDK installed, also make sure you have the include file looking exactly like this:
#include <d3d9.h>
#include <d3dx9.h>

and in the project properties under Config Properties>Linker>Input
you have:
d3d9.lib
d3dx9.lib

making sure each .lib file is seperated by a space.


Hope that helps,
Progames25
-----------------------------I use C++ and DirectX.I'm new to game programming.
I think that visual c++ comes with the latest Direct x SDK That's why i am so confused The compiler i installed was just a few weeks ago. What about those .vsh files aren't they supposed to be included, if so where do i put them header, source folders, where exactly?

3dmodeler
http://digitalart.f-sw.com
Quote:Original post by 3dmodeler
I am a complete beginner to directx and just got a new compiler( my first ever)
Visual c++ express edition. I asked my question on the msdn forums but they sometimes don't answer so i was hoping someone here would know. I ahve a a directx 9.0 book in it there are lots of examples to compile. The book was made for two specfic compilers visualc++ 6.0 or visual c++.net I am not using either so it is confusing since there are certain files you have to include depending on what compiler you use. In one example called Dolphin I include the main.cpp
the resource.h and winmain.rc I get an error that says can't find D3DX9.h when i add that i still get the same error What i am asking is what exactly are the files i have to add? I know it sounds dumb but i must be missing something. Also according to the readme file there are two .vsh files but those files are in another directory, who knows why. do i add those? Hopefully this will make sense to someone


Quote:Original post by 3dmodeler
I think that visual c++ comes with the latest Direct x SDK That's why i am so confused The compiler i installed was just a few weeks ago. What about those .vsh files aren't they supposed to be included, if so where do i put them header, source folders, where exactly?
Visual C++ .NET is almost identical to Visual Studio 2008 (Which is presumably what you have).

The DirectX SDK does not come with Visual Studio - that'd be an unnecessary addition for a lot of people, so you need to download it seperately to compile DirectX code.
Having said that, if the book has a version of the DirectX SDK on the CD, I'd install that (for now), since the SDK has changed a lot recently and newer SDKs probably won't work without a bit of tinkering.

VSH are Vertex SHader files. You don't include them in any way when building the code, they're data files.
The book should probably have a project workspace (A .sln file, or possibly .dsw for VS6) - you should open (And convert if it prompts you) that, since that'll have all the source files added to the project and should be ready to compile once you've installed all the necessary SDKs.
A few more questions first off what is the winmain.rc file anddo i include that and where? I installed Direct SDK 9.0 a ferw years ago. If I download the latest Directx SDK 10 I heard that it either won't compile in my xp pro system or that if it does compile won't be able to run the program Am misunderstanding something?

3dmodeler
http://digitalart.f-sw.com
Well, there isn't really a 'directx 10 sdk'. There's the August 2008 DirectX SDK. This SDK should include everything you need for working with either directx 9 or directx 10.

Each SDK will mention all changes from the previous version. If you look at the June 2008 SDK it says it has removed DirectX 8 related items and managed directX related items without mentioning removing DirectX 9 functionality. The Auguest 2008 SDK doesn't mention removing anything at all, much less DirectX 9.

If it takes MS the same amount of time to get rid of DirectX 9 as it took to get rid of DirectX 8 it'll be another 2-4 years before they remove it from the SDK. And even then you can always download earlier versions of the SDK>

Clicky.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Quote:Original post by 3dmodeler
A few more questions first off what is the winmain.rc file anddo i include that and where? I installed Direct SDK 9.0 a ferw years ago. If I download the latest Directx SDK 10 I heard that it either won't compile in my xp pro system or that if it does compile won't be able to run the program Am misunderstanding something?

3dmodeler
You can't run D3D10 apps on XP, you need Vista. You'll be able to compile D3D10 apps, but it's a bit pointless unless you have a Vista machine to run on. D3D10 requires a totally different driver model, and trying to get it to run on XP is like getting D3D9 to run on Linux - there's projects out there trying to do it, but it's pretty flakey, not really practical, and not officially supported.

winmain.rc is a resource file. If you add it to your project, then Visual Studio will compile the resources into your EXE file. Again, if this is code from a book it should have a project file already, and the resource file will already be added.
Quote:Original post by Progames25
Yeah, make sure you ahve the latest DirectX SDK installed, also make sure you have the include file looking exactly like this:
#include <d3d9.h>
#include <d3dx9.h>

and in the project properties under Config Properties>Linker>Input
you have:
d3d9.lib
d3dx9.lib

making sure each .lib file is seperated by a space.


Hope that helps,
Progames25


Under Config Properties>Linker>Input I don't have anything. How do i link to them? I am using visual c++ express edition 2008

3dmodeler

http://digitalart.f-sw.com
Quote:Original post by 3dmodeler
Under Config Properties>Linker>Input I don't have anything. How do i link to them? I am using visual c++ express edition 2008

3dmodeler
You put "d3d9.lib; d3dx9.lib" (no quotes) in the "Additional Dependencies" field.

This topic is closed to new replies.

Advertisement