Still new to DirectX

Started by
4 comments, last by SiCrane 19 years, 5 months ago
What does #define INITGUID mean....? Thx!
Advertisement
I believe it initializes COM for Direct X.
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

ThankX
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.

#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...

example:

vb:
Dim d3d9Device as new Microsoft.Directx.Direct3d.Device

c#/c++.net:

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...
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.

This topic is closed to new replies.

Advertisement