I am writing a DLL that will serve to wrap the frequently used parts of the Win32 API in a set of C++ classes. My problem is that I keep getting compilation errors that some base class or another is undefined. I suspect this is a #include problem because a lot of my classes all depend on each other and there are a couple of circular dependencies that I'm resolving with the #pragma once directive. I've read that problems can be caused this way, but I'm not sure of that's what's going on here.
Here are the classes I currently have:
FzaLib.h - The main header to be #included from projects that use this dll. Only contains dllmain() and some #defines.
Controller.h - Contains the window procedure and code to register/unregister GuiObjects in a vectored list.
Exception.h - Derives from std::exception. Needed so I can throw them when API calls fail in constructors.
Easel.h - Container for DC, RECT, brush, and color for GDI functions.
GuiObject.h - Base class for Windows GUI elements. Basically a container for HWND with some functions.
Window.h - Derives from GuiObject. A generic application window.
....h - Other class types that will derive from GuiObject.
Here's how their relationships work:
FzaLib.h needs to #include Controller.h. That's where the window procedure is.
Controller.h - Needs GuiObject.h, Exception.h, and the system headers <windows.h> and <gdiplus.h>.
Exception.h needs <exception> and <windows.h> again for the GetLastError() and FormatMessage() API calls.
Easel.h #includes <windows.h> and <gdiplus.h> again.
Here's where it gets sticky. GuiObject.h needs Controller.h because controller is a friend. Circular dependency #1.
Window.h and other derived classes need GuiObject.h. Circular dep #2 because GuiObject #includes controller.h.
Controller.h needs to #include all of GuiObject's derived classes or else they can't be instantiated unless the program using the library #includes each one manually. Circular dependency #3.
The point where the compiler barfs is when it tries to compile Window.cpp. It swears that GuiObject base class is undefined. Coincidentally (or maybe not), this is the only point where inheritance is used thus far (I haven't written any of the other derived classes yet, but I'm sure the problem will be the same).
How do I #include this to work? Maybe I am wrong in assuming this is a #include problem? Is there something special you have to do to use inheritance within a DLL?