The information in this article applies to:
SUMMARY
A GUID must be initialized exactly once. For this reason, there are two
different versions of the DEFINE_GUID macro. One version just declares an
external reference to the symbol name. The other version actually
initializes the symbol name to the value of the GUID. If you receive an
LNK2001 error for the symbol name of the GUID, the GUID was not
initialized.
MORE INFORMATIONHere is the definition of DEFINE_GUID as it appears in OBJBASE.H:
Note that if the symbol INITGUID is not defined, DEFINE_GUID simply
defines an external reference to the name.
In INITGUID.H, you find (among other things):
By including INITGUID.H after OBJBASE.H, DEFINE_GUID is modified to
actually initialize the GUID.
NOTE: It is important to make sure that this is done exactly once for each DLL or EXE. If you try to initialize the GUID in two different implementation files and then link them together, you get this error:
Keywords : kbole kbGenInfo kbVC kbVC200 kbVC210 kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 |
Last Reviewed: August 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |