Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLL, Class Constructors

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I should know the answer to this, but sadly I don't!

I'm creating a DLL that contains a base class which has 2 constructors. My DLL compiles fine but when I call my new class from another app I get the following error;
unresolved external symbol "public: __thiscall CGetTeam::CGetTeam(class CString)" (??0CGetTeam@@QAE@VCString@@@Z)

Now I know that if I copy and paste the last bit of the error message (??0CGetTeam@@QAE@VCString@@@Z) into the .def file of the .dll project and recompile it, all will be well.

My question is, how do you populate the .def file correctly, i.e. rather than this back-to-front way that I'm doing it?. Not a serious problem, but I'd like to know the answer before someone comes and asks ME how to do it.

thanks.
 
Do you have the class declared as __declspec(dllexport) in your header file? This should set it up so that when you build the .dll, the .def file is created. Do you have the same problem with your other constructor?
 
Thanks for the reply.
Yes I do have the constructors declared with __declspec(dllexport) and the same problem occurs when I access the class via the other constructor.
 
I should have read your reply more closely!
I had __declspec(dllexport) before the declaration of the constructors themselves in the header file, when in fact all I had to do was put __declspec(dllexport) in front of the class name.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top