How to Avoid Error L2029 Unresolved External Using DEFINE_GUIDID: Q130868
|
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
L2029 error for the symbol name of the GUID, the GUID was not initialized.
You can make sure your GUID gets initialized in one of two ways:
Here is the definition of DEFINE_GUID as it appears in COMPOBJ.H:
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID CDECL FAR name
#ifdef INITGUID
#include "initguid.h"
#endif
NOTE: If the symbol INITGUID is not defined, then DEFINE_GUID simply
defines an external reference to the name.
#undef DEFINE_GUID
// Other Code . . .
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID CDECL __based(__segname("_CODE")) name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
Therefore, include INITGUID.H after COMPOBJ.H DEFINE_GUID is modified to
actually initialize the GUID.L2025: <symbol> : symbol defined more than once.
Additional query words: kbinf 1.50 1.51 1.52
Keywords : kberrmsg kb16bitonly kbGenInfo kbVC
Version : 1.50 1.51 1.52
Platform : WINDOWS
Issue type :
Last Reviewed: July 26, 1999