   C++ inheritance problem
  Hello fellow C++ programmers!Here's a portion of my renderer class which gets implemented in a separate DLL for a specific graphics API.class renderer{public:renderer();virtual ~renderer();virtual void release() = 0;};And here is the specific D3D version of it.class rendererD3D : public renderer{public:rendererD3D(HINSTANCE DLL);~rendererD3D();void release();};Now, the problem is when I implement the con/de -structors I'm presented with unresolved external symbol errors(by visual studio 2008).But if I change the con/de -structors in the base class like this:renderer(){}virtual ~renderer(){}...all my problems are vanished.Why? I'm asking 'cause I couldn't really find sg. like this anywhere(maybe because it's so obvious(at least for everyone except Me)).Thanks in advance![smile]Matyi   
  You are probably not defining the constructor/destructors.Make sure a cpp file gets loaded that contains the functions, or don't define them at all if they don't contain any specific code.   ;  When you instantiate the derived class, it calls the base class constructor before it calls the derived constructor.class a{public:    a(){ std::cout << "a\n"; }};class b : public a{public:    b(){ std::cout << "b\n"; }};int main(){    b v;}The above will produce the output:abSo your program is trying to call the constructor of renderer before it calls the constructor of rendererD3D. Since you have put in the prototype for the default constructor in renderer, this prevents the compiler from creating a default constructor automatically and you get your unresolved error.Similarly with the destructor, when your derived class is destroyed, the destructors are called for the derived class, then the base class (reverse order to constructors) and since you have declared a destructor prototype in renderer, it prevents the compiler from creating one automatically.When you add the empty function stubs ({ }) to the ends of these in renderer, you create empty function bodies that the linker can then find.   ;  Also, you will need to export the class from the DLL.  Something like: class __declspec(dllexport) renderer {}when you compile your DLL and class __declspec(dllimport) renderer {}when you use the library containing the class.I'm usually I usually define an export.h for each library that handles this for me with preprocessor defines.  For example#ifndef uiExport_H_#define uiExport_H_#ifdef _WIN32   #ifdef UI_EXPORTS #define DLL_EXPORT_UI __declspec ( dllexport )   #else #define DLL_EXPORT_UI __declspec ( dllimport )   #endif#else   #define DLL_EXPORT_UI#endif#endif This takes care of both cases for windows (import/export) and for when I build on linux (nothing).  When I build my library, I define UI_EXPORTS as a preprocessor token, and when I use the library (build against it), I don't define it and all is good with the world.cheers, Bob   ;  We recently had  another thread on this same topic.   ;Quote:Original post by SiCraneWe recently had  another thread on this same topic.[oh]Sorry! 'll be more careful next time.[rolleyes]Anyway thanks for all the answers! These and a bit of diggin' in the book C&#43&#43 FAQ and now I'm totally enlightened.Thanks again!   