• Create Account

### #Actualrip-off

Posted 25 July 2012 - 07:01 AM

It is a static variable, so it must be defined outside of any function. The lines I quoted would go, for example, here:
#include <iostream>
#include <string>
#include "console.h"

using namespace std;

string Console::prefix = "[Log]";

void Console::setPrefix(string msg) {
prefix = msg;
}

void Console::log(string msg) {
std::cout << prefix << " " << msg;
}


### #2rip-off

Posted 25 July 2012 - 07:00 AM

It is a static variable, so it must be defined outside of any function. The lines I quoted would go, for example, here:
#include <iostream>
#include <string>
#include "console.h"

using namespace std;

string Console::prefix = "[Log]";

void Console::setPrefix(string msg) {
prefix = msg;
}

void Console::log(string msg) {
std::cout << prefix << " " << msg;
}


### #1rip-off

Posted 25 July 2012 - 07:00 AM

It is a static variable, so it must be defined outside of any function. The lines I quoted would go, for example, here:
#include <iostream>
#include <string>
#include "console.h"

using namespace std;

string Console::prefix = "[Log]";

void Console::setPrefix(string msg) {
prefix = msg;
}

void Console::log(string msg) {
std::cout << prefix << " " << msg;
}


PARTNERS