I'm trying to throw an exception in c++ that is personalized. I've also tried to declare the exception class in the namespace without include the headers directly on the affected class but seems that nothing works properly... Also with Linker :(
Exception class:
#pragma once
#include <stdexcept>
class NoBaseClassCallException : public std::exception
{
public:
NoBaseClassCallException();
const char* what() const throw() override
{
return "NoBaseClassCallException";
}
~NoBaseClassCallException();
};
My code where I want to throw the exception:
#pragma once
#include "NoBaseClassCallException.h"
LoggerFile::LoggerFile()
{
if (Logger::isNotOperating())
throw new NoBaseClassCallException();
}
Error code of Linker:
LoggerFile.obj : error LNK2019: unresolved external symbol "public: __thiscall NoBaseClassCallException::NoBaseClassCallException(void)" (??0NoBaseClassCallException@@QAE@XZ) referenced in function "public: __thiscall LoggerFile::LoggerFile(void)" (??0LoggerFile@@QAE@XZ)
Any reference or help to understand what is happening would be very grateful!
Thank you in advance.