100 points: 1 class can't use another - #include gives link errs
Posted on 2003-11-21
I am writing my my first ever serious Visual C++ 6 visual application. To give you a run down, i have created a default dialog program and created some extra dialogs.
I have core functional classes named Hobby, Client, DatingAgency (im sure you see where this is going)
To jump straight to the problem, if i try to use: #include "Client.h" i get the following error:
(this happens during linking)
WindowTestDlg.obj : error LNK2005: "public: __thiscall Client::Client(void)" (??0Client@@QAE@XZ) already defined in WindowTest.obj
This is repeated for every method of the Client object. If i don't use #include then i can't access the client class (undeclared identifier).
Now i deleted Client.cpp and wrote the declaration and the implementations in the header file, because im using #include <list> and using the STL List object.
Does anybody recognise this error? And know it's solution?
(extra info that may help: MS Visual C++ 6.0 Ent. Ed., Windows XP Pro)
(If you answer this corretly i will point you to a question that i posted for 70 points and never gave to anybody because i solved it myself. You can add a comment and i will give you those points as well.)