In the library I'm currently building, I'm trying to avoid including header files in other header files. It's worked so far using forward declaring of other classes, and then simply including those headers in the .cpp file. However, this doesn't seem to work for me with template classes. Here's what I have code wise:
template <typename T>
class Singleton;
class LogManager : public Singleton<LogManager>
{
...
};
However when compiling I get a couple errors:
LogManager.h:25: error: declaration of 'struct Island::Singleton<Island::LogManager>'
LogManager.h:27: error: invalid use of undefined type 'struct Island::Singleton<Island::LogManager>'
where line 25 is where I'm trying to declare the Singleton class and 27 then is when I'm trying to use it. Being that I'm deriving from the Singleton class, is that the reason I can't use forward declaring? Or is there another reason? If it matters I'm using Xcode on OS X, newest version. I think it uses GCC 4 but I might be mistaken.