Jump to content
• Advertisement

Archived

This topic is now archived and is closed to further replies.

INITGUID

This topic is 5633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, whats the importance of using #define INITGUID I know there is some, heres my problem. If I compile my project, it compiles fine. Runs, initialises DirectDraw, displays my animation and exits when I press a key. Now, I put #define INITGUID #define WIN32_LEAN_AND_MEAN in my WinMain.cpp and woah! blah.. already defined in WinMain.obj everywhere.. why? What does INITGUID do for me? or do to me for that matter... Thanks for any answers, I haven''t used it in my projects before. =*= If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore =*=

Share this post

Share on other sites
Advertisement
INITGUID must be defined in ONE place and one place only. It determines (by defining a symbol in a Windows header) whether GUIDs will be defined for DirectX interfaces. DirectDraw for example uses GUIDs like "IID_IDirectDrawSurface7".

Personally I prefer to remove all #define INITGUIDs from all my source files and link with dxguid.lib which also contains those GUIDs (IIDs). That way you don''t have to worry about only one file containing the init.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post

Share on other sites
right, so as long as I have

#pragma comment(lib,"dxguid.lib")

or I link with it, its valid ?

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=

Share this post

Share on other sites
quote:
Original post by hammerstein_02
right, so as long as I have

#pragma comment(lib,"dxguid.lib")

or I link with it, its valid ?

Yes.

[Unless your code needs Windows GUIDs unrelated to DirectX, but most DX apps don''t]

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post

Share on other sites
thank-you very much, that helped greatly!

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=

Share this post

Share on other sites
I''m having a problem with "#define INITGUID" myself.

I''ve incorporated the GetDXVer sample (from the DX SDK) into my own code. The sample #defines INITGUID, but I thought I could remove it seeing as my project settings link to "dxguid.lib".

However when I take it out I get linking errors:
DX_Version.obj : error LNK2001: unresolved external symbol _CLSID_DxDiagProviderDX_Version.obj : error LNK2001: unresolved external symbol _IID_IDxDiagProvider

Any ideas on this? I''m probably missing something obvious

pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

Share this post

Share on other sites
quote:
Original post by pan narrans
I''m having a problem with "#define INITGUID" myself.

I''ve incorporated the GetDXVer sample (from the DX SDK) into my own code. The sample #defines INITGUID, but I thought I could remove it seeing as my project settings link to "dxguid.lib".

However when I take it out I get linking errors:
DX_Version.obj : error LNK2001: unresolved external symbol _CLSID_DxDiagProviderDX_Version.obj : error LNK2001: unresolved external symbol _IID_IDxDiagProvider

Any ideas on this? I''m probably missing something obvious

Unfortunately I don''t have the DX9 SDK installed on this machine so can''t check for definate, but it sounds like the DXDIAG symbols aren''t included in dxguid.lib. Probably because that''s an external component rather than a core part of the SDK. dxguid.lib only contains GUIDs for the core.

The GUIDs for DXDIAG are in the dxdiag.h header, they are instanced with a DEFINE_GUID() macro. The behaviour of that macro depends on whether the INITGUID symbol has been defined. If it has been defined, then a const object containing the GUID is created (which is why there must only be one INITGUID). Otherwise the DEFINE_GUID creates an "extern" to the same symbol name, the symbol is then defined in the .lib file.

Solutions in this particular case:

1) remove ALL dxguid.lib and in **ONE** file, a single #define INITGUID followed by a #include of the header for each component which may require GUIDs (e.g. "d3d.h", "dxdiag.h", "dinput.h")

2) alternatively, leave the dxguid.lib in and then ONLY in the file which requires the DXDIAG GUIDs do:
#define INITGUID
#include <dxdiag.h>
#undef INITGUID
...usual #includes here...

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post

Share on other sites
Went for door number 2, worked beautifully. Thanx

pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

Share this post

Share on other sites

• Advertisement

Announcements

• Advertisement

• Popular Contributors

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5
• Advertisement

• 10
• 11
• 37
• 12
• 12
• Forum Statistics

• Total Topics
631414
• Total Posts
2999958
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!