#Singleton causes LNK2001 (Unresolved external symbol)

5 messages · Page 1 of 1 (latest)

distant otter
#
#pragma once

#include <iostream>

#include "Core.h"

class Logger {
public:
    Logger() { instance = this; } 

    static Logger* Get() { return instance; }

    void Log(const char* msg) {
        printf(msg);
    }

    void Error(unsigned int line, const char* error) {
        printf("[%u] %s", line, error);
        hadError = true;
    }

public:
    bool hadError = false;
    bool hadRuntimeError = false;

private: 
    static Logger* instance; 
};
#

Btw, this is probably some stupidly common error, I just have no idea what to search up to find it and the things ive tried havent exactly given me any results.

distant otter
#

wait, i fixed it, i just had to put the definition in a c++ file

#

[SOLVED] Singleton causes LNK2001 (Unresolved external symbol)

pliant tapirBOT
#

@distant otter

This question thread is being automatically marked as solved.