Philluminati
asked on
100 points: 1 class can't use another - #include gives link errs
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.)
Thanks
Phill
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.)
Thanks
Phill
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry - i never told you how i solved the problem. I added client.cpp back into the project and copy and pasted the definition in to its own file. Then it worked!
That easy
Thanks
Phill
That easy
Thanks
Phill
Phil..
You ought to ask in Community Support to close that other question and get your points back. Then post a new question in _this_ group, with a topic line of 'Points for andrewjb' and a reference to _this_ question. Then I'll comment in the new one, and you can give me the points.
Someone's going to be annoyed if you accept me as an answer in some unrelated Q, and you'll get told off by the admins!
You ought to ask in Community Support to close that other question and get your points back. Then post a new question in _this_ group, with a topic line of 'Points for andrewjb' and a reference to _this_ question. Then I'll comment in the new one, and you can give me the points.
Someone's going to be annoyed if you accept me as an answer in some unrelated Q, and you'll get told off by the admins!
ASKER
I'm shocked, my answers been correctly solved in less than an hour. Thats fantastic!
Thank-you very much, problems like that are a real pain. You know it's obvious but you don't have enough experience to know what it is. Thanks mate.
My end of the bargin: I promised you 100 points so copy and paste the path into address bar, leave a small comment and ill assign the 70 points there for you. (30 from this question).
https://www.experts-exchange.com/questions/20790470/Cannot-Cancel-sending-a-read-receipt.html#9700755
Thanks
Phillip Taylor