Little linker probs

Started by
0 comments, last by SiCrane 18 years, 3 months ago
Hi there! Today is one of those days when nothing seems to work. For the first time in months I've got some crazy linker errors I can't get rid of (thought those times were through...pretty emberassing). I've created a header file, in which I declare some HLSL extensions:

#ifndef hc_OpenGLExtensions
#define hc_OpenGLExtensions


// Extensions needed for GLSL
PFNGLCREATEPROGRAMOBJECTARBPROC		glCreateProgramObjectARB;
PFNGLDELETEOBJECTARBPROC			glDeleteObjectARB;
PFNGLUSEPROGRAMOBJECTARBPROC			glUseProgramObjectARB;
PFNGLCREATESHADEROBJECTARBPROC		glCreateShaderObjectARB;
PFNGLSHADERSOURCEARBPROC			glShaderSourceARB;
PFNGLCOMPILESHADERARBPROC			glCompileShaderARB;

#endif

This file gets included by all other files in the project. This leads to this list of errors: CEngineCore.obj : error LNK2005: "void (__stdcall* glUseProgramObjectARB)(unsigned int)" (?glUseProgramObjectARB@@3P6GXI@ZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "int (__stdcall* glGetAttribLocationARB)(unsigned int,char const *)" (?glGetAttribLocationARB@@3P6GHIPBD@ZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "unsigned int (__stdcall* glCreateProgramObjectARB)(void)" (?glCreateProgramObjectARB@@3P6GIXZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "void (__stdcall* glActiveTextureARB)(unsigned int)" (?glActiveTextureARB@@3P6GXI@ZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "void (__stdcall* glDeleteObjectARB)(unsigned int)" (?glDeleteObjectARB@@3P6GXI@ZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "void (__stdcall* glGetInfoLogARB)(unsigned int,int,int *,char *)" (?glGetInfoLogARB@@3P6GXIHPAHPAD@ZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "void (__stdcall* glVertexAttribPointerARB)(unsigned int,int,unsigned int,unsigned char,int,void const *)" (?glVertexAttribPointerARB@@3P6GXIHIEHPBX@ZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "void (__stdcall* glAttachObjectARB)(unsigned int,unsigned int)" (?glAttachObjectARB@@3P6GXII@ZA) already defined in CTimer.obj CEngineCore.obj : error LNK2005: "void (__stdcall* glEnableVertexAttribArrayARB)(unsigned int)" (?glEnableVertexAttribArrayARB@@3P6GXI@ZA) already defined in CTimer.obj ... ..and so on. There's over 500 of them!!! I'm pretty sure it's a stupid little mistake but I can't figure it out right now :-( Can anyone give me clue? Thank's a lot guys!
Advertisement
Like all global variables, extension pointers stored in header files should be declared extern, and then you need to define them in one source file.

This topic is closed to new replies.

Advertisement