Beginner here.
I´ve recently written a bit of code to log using spdlog.
I based it on a "Singleton" base class and it doesn´t seem to be working, which irritates me, since in all other cases that I´m using that exact "Singleton" base class it works.
I get the following errors:
1>D:\dev\Makeshift\MakeshiftEngine\src\Utility\Log.h(20,33): error C2504: 'Singleton': base class undefined
1>D:\dev\Makeshift\MakeshiftEngine\src\Utility\Log.h(20,33): error C2143: syntax error: missing ',' before '<'
1>D:\dev\Makeshift\MakeshiftEngine\src\Utility\Log.h(24,16): error C3668: 'MS::Debug::Logger::Init': method with override specifier 'override' did not override any base class methods
Some Resource to work off of
Singleton Class
namespace MS
{
template <class T>
class Singleton
{
public:
static T& Get();
virtual void Init() {};
virtual void Shutdown() {};
protected:
explicit Singleton<T>() = default;
};
template<typename T>
T& Singleton<T>::Get()
{
static_assert(std::is_default_constructible<T>::value, "<T> needs to be default constructible");
static T m_Instance;
return m_Instance;
}
} // namespace MS
Logging Class
#include "Utility/Singleton.h"
namespace MS
{
namespace Debug
{
class Logger : public Singleton<Logger>
{
public:
virtual void Init() override;
static std::shared_ptr<spdlog::logger> getConsole();
protected:
static std::shared_ptr<spdlog::logger> m_Console;
};
}
}
and (if necessary) the function it is being called from
MS::Debug::Logger::Get().Init();
// For those who are downvoting, could you please explain why?
// Is it my formatting?
// or Is my question just THAT dumb?
// If it is the latter, I am sorry, but I would still greatly appreciate it if you could answer it.
Thank you guys very much in advance for answering :D
Sorry if this is a stupidly simple question, I am a beginner and I couldn´t find the answer, eventhough it was probably staring me right in the face :)