So I am using a game engine creation tutorial series on youtube by The Cherno. When we implemented logging into the project, we used a git repo spdlog (https://github.com/gabime/spdlog). Basically, when I tried compiling, I got two three errors:
2>SandboxApp.obj : error LNK2001: unresolved external symbol "private: static class std::shared_ptr Hazel::Log::s_CoreLogger" (?s_CoreLogger@Log@Hazel@@0V?$shared_ptr@Vlogger@spdlog@@@std@@A)
2>SandboxApp.obj : error LNK2001: unresolved external symbol "private: static class std::shared_ptr Hazel::Log::s_ClientLogger" (?s_ClientLogger@Log@Hazel@@0V?$shared_ptr@Vlogger@spdlog@@@std@@A)
2>C:\code\repos\Hazel\Hazel\bin\Debug-x64\Sandbox\Sandbox.exe : fatal error LNK1120: 2 unresolved externals
I have my own git repo if you want to check it out, https://github.com/glebnersisyan/HazelFollow/ otherwise, these are the problematic files:
Log.h:
#pragma once
#include <memory>
#include "Core.h"
#include "spdlog/spdlog.h"
namespace Hazel {
class HAZEL_API Log
{
public:
static void Init();
inline static std::shared_ptr<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
inline static std::shared_ptr<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }
private:
static std::shared_ptr<spdlog::logger> s_CoreLogger;
static std::shared_ptr<spdlog::logger> s_ClientLogger;
};
}
and Log.cpp:
#include "Log.h"
namespace Hazel {
std::shared_ptr<spdlog::logger> Log::s_CoreLogger;
std::shared_ptr<spdlog::logger> Log::s_ClientLogger;
void Log::Init()
{
spdlog::set_pattern("%^[%T] %n: %v%$");
}
}