dll linking problem with derived class

Started by
6 comments, last by lem77 18 years, 9 months ago
Hi all, I´m building an engine for demo/gfx stuff. (edited: engine is compiled as dll). In it I have two classes: a class interface CEffect (which I want my effects derive from) and a singleton-CEffectManager in ONE .h and ONE .cpp file. Everything fine so far. Now I want to code my first effect (standard bitmap =D), which basicaly just shows a textured quad. So I added two new files (CEffect_Standard_Bitmap.h and CEffect_Standard_Bitmap.cpp) and coded a function in CEffectManager which looks like this: Now when I build my project compiling is fine, but then I get a link error: Bibliothek 'bin\Debug/Lem3D_D.lib' und Objekt 'bin\Debug/Lem3D_D.exp' wird erstellt effect.obj : error LNK2019: Nicht aufgelöstes externes Symbol '"public: __thiscall Lem3D::CEffectStandardBitmap::CEffectStandardBitmap(void)" (??0CEffectStandardBitmap@Lem3D@@QAE@XZ)', verwiesen in Funktion '"public: class Lem3D::CEffect * __thiscall Lem3D::CEffectManager::BuildEffect(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?BuildEffect@CEffectManager@Lem3D@@QAEPAVCEffect@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00H@Z)' bin\Debug/Lem3D_D.dll : fatal error LNK1120: 1 unaufgelöste externe Verweise HELP please :) [Edited by - lem77 on August 9, 2005 12:14:27 PM]
Advertisement
It sounds like it can't find the constructor for the class. Are you sure you defined it?

Also, you mention a DLL in the title, but don't mention what is in a DLL in your post.
No problems seem to apparent here, might help posting the class declaration for CEffectStandardBitmap... At a quick guess I'd look at #ifndef statements (make sure u haven't got the same #ifndef in another header if u copy pasted between headers, done this a few times), the constructor (is there one that takes no parameters). Also try a clean build, on both projects.



Richard.
Its hard to tell from your post exactly what's going on, but you might need to DLL export your class. Use the __declspec(dllexport) stuff (see the docs).

Quote:Original post by krum
Its hard to tell from your post exactly what's going on, but you might need to DLL export your class. Use the __declspec(dllexport) stuff (see the docs).


I did it for the CEffectManager, since I want that to be accesible from the client app. The CEffect/CEffectStandardBitmap should be internal classes handled by the manager.

Quote:Original post by SiCrane
It sounds like it can't find the constructor for the class. Are you sure you defined it?

Also, you mention a DLL in the title, but don't mention what is in a DLL in your post.


These function and classes are part of the dll, or did I understand you wrong?




[Edited by - lem77 on August 9, 2005 12:07:55 PM]
anyone?
SiCrane, u rock :)

Linker had problems with undeclared virtual destrucor of the base class.
I splitted the CEffect and CEffectManager into seperated files, and then i still had a linker error, but with "better" error message, that destructor couldn´t be found.

Thanx a lot

This topic is closed to new replies.

Advertisement