A Link error

Man, it seems all my questions here are never OpenGL related, but I don’t know of any other large C++ forum.

I’ve been getting this Link Error for a couple days now… kinda making me angry. Here it is…

“main.obj : error LNK2005: “class vector EYEPOS” (?EYEPOS@@3Vvector@@A) already defined in dispmode.obj”

And it does that for all the global variables I have in my header “dispmode.h”. That header is only included in 2 source files: dispmode.cpp and main.cpp. And the very first line in the header is “#pragma once” so that shouldn’t be a problem. I just have no idea why I’m getting this error. Any help would be greatly appreciated. Thanks!

Are you trying to use a global vector called EYEPOS? And in the header did you use extern? If so, you should have the variable declared again in only ONE other source file.

For instance… in the .h

extern vector EYEPOS;

In ONE of the .cpp files

vector EYEPOS;

Hope that helps.

Doh! I forgot to put extern on the variables in the header! Thanks a bunch!