Declaring class objects in a header file
问题 Greetings everyone. I seem to be snagging on a fundimental but I cant find the solution anywhere. Anywho, will go ahead and explain. I have a program consisting of three files; main.ccp, add.h, add.cpp. I declare the class 'SA' in add.h and have all my functions defined in add.cpp additional.h class SA { ... public int x; } Obj1, Obj2; main.ccp #include "additional.h" int main() { Obj1.x = 5; ... } This gives me a link error on compiling: error LNK2005: "class SA Obj1" (?Obj1@@3VSA@@A)