I have the following lines in a header file…
typedef void (APIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
typedef void (APIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage);
PFNGLGENBUFFERSARBPROC glGenBuffersARB = NULL; PFNGLBINDBUFFERARBPROC glBindBufferARB = NULL; PFNGLBUFFERDATAARBPROC glBufferDataARB = NULL; PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = NULL;
and when I include this header in any other file, I always get a
"fatal error LNK1169: one or more multiply defined symbols found " in the visual studio.
I wanted to keep these declarations in a seperate header file.
any help appreciated.
still a long way to go…
You need to declare those function pointers
extern. Just as with any other global variable you stick in a header. You also can’t initialize them to NULL in the header; that can only happen in the source file.
And since they’re
externed in the header, you must define them in a source file (just one) somewhere. Probably the place you have your function pointer loading code.
Oh, and please stop using the extension form of buffer objects! It’s been core OpenGL functionality for near on a decade now. Use the core functions, the ones that don’t end in “ARB”.
thanks for the good tip.
after a long search I realized the resources on VBO and I hope I come out of the jinx and start to use the programmable pipeline after going through the book.
Any more information or links would be really helpful.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.