GUID problem
I am trying to put the guid define in a shared header along with other program variable defintions. But i get this error
error LNK2001: unresolved external symbol _g_guidApp
this is the code i am using:-
#pragma once
#define INITGUID
// {8FDDD389-5A0F-4465-AFCF-B400A1CB2E05}
DEFINE_GUID(g_guidApp,
0x8fddd389, 0x5a0f, 0x4465, 0xaf, 0xcf, 0xb4, 0x0, 0xa1, 0xcb, 0x2e, 0x5);
#define DEFAULT_SESSION_NAME TEXT("Session 1")
const DWORD CLIENTSERVER_PORT = 2699;
I am linking to dxguid.lib the problem is when i try to include this header in more than one source file.
According to this, guiddef.h File Reference the DEFINE_GUID macro is as follows:
That's from the rotor pal docs, so it might not hold for all headers (even though it seems that it should). It would seem that when including the header in multiple files leads to declaring the variable multiple times which in conjunction with the 'extern' keyword raises the linker error. I'm not sure how to resolve the problem.
#define DEFINE_GUID ( name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8 ) EXTERN_C const GUID FAR name
That's from the rotor pal docs, so it might not hold for all headers (even though it seems that it should). It would seem that when including the header in multiple files leads to declaring the variable multiple times which in conjunction with the 'extern' keyword raises the linker error. I'm not sure how to resolve the problem.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement