Sign in to follow this  

Still new to DirectX

Recommended Posts

Hermes    144
I took it from a tutorial ...,but if i use it i get a lot of Lnk2005(multiple defines)error...and if i eliminate it everything goes back to normal ,no errors.
Do you know why does this happen?

I use Dx9


Share this post

Link to post
Share on other sites
darookie    1441
The tutorial possibly used an old version of the DXSDK.
In the current release you must not define internal macros sush as INITGUID manually because it is already done for you inside the SDK headers.

Share this post

Link to post
Share on other sites
#define creates a constant that can be used like a variable

In this case, it is the globaly unique identifier for the directx object at hand.

If c.o.m is troubling you, consider programming in .net

All the hassle of Directx app creation is eliminated as COM objects can be used like variables...


Dim d3d9Device as new Microsoft.Directx.Direct3d.Device


Microsoft.Directx.Direct3d.Device d3d9Device =new Microsoft.Directx.Direct3d.Device();

I tell you it's childs play, and get this, the windows gui is put into a class fo you! The .Net platform frees you from designing the game around a gui and within a hour or so, you could create a few classes capable of rendering 3d models. (or so from what I've done) Best of all, the compiler is for free.
Anything else you'd like to know , ask me...

Share this post

Link to post
Share on other sites
SiCrane    11839
If you use INITGUID, you should only defined it in exactly one source file before you include the DirectX headers. Which means that INITGUID should not go in headers.

What it does is intialize storage for the GUIDs that DirectX uses to refer to all the COM stuff. So by defining it in more than source file it does basically the same thing that happens if you define the same global variable in multiple source files.

A better alternative to dealing with the INITGUID stuff is to link against dxguid.lib.

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