You have declared your static variable Console::prefix, but you have yet to define it. The definition goes in a single source file (the obviously candidate being console.cpp) and looks like this:
string Console::prefix;
You may want to initialise it with a default prefix:string Console::prefix = "[hello, world]";
I now added the following lines to the Console class in console.cpp (Under "public:"):
Console() {
prefix = "[Log]";
}
Tried to build and got the following error now:
Undefined symbols for architecture x86_64: "_main", referenced from: start in crt1.10.6.o "Console::prefix", referenced from: Console::setPrefix(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in console.o Console::log(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in console.o ld: symbol(s) not found for architecture x86_64
Does is has to do something with the strings maybe? (I personally don't think so though)
Or does it has to be something with the way how I use the fields of the class?