Possible Duplicate:
Access issue regarding static variable
I'm having what seems to be a really trivial problem but I can't seem to work out what the cause is.
I have a class called storage. Header File:
#include <string>
using namespace std;
#include "Player.h"
class Storage {
public:
static void Initialise();
static string GetInformation();
private:
static Player player;
};
CPP File:
string Storage::GetInformation() {
string returnString = "";
// Get the players money
// Convert it to a string
string money("money");
stringstream out;
out << player.GetMoney();
money = out.str();
returnString += "Money: " + money + "\n";
// Get the players ship information
returnString += player.GetShipInformation();
// Get the players current location
returnString += player.GetCurrentLocation();
return returnString;
}
void Storage::Initialise() {
}
This gives an error: "undefined reference to `Storage::player'". I've tried googling it and tweaking things, but I can't seem to find anything that works. If someone could point me in the right direction for an article to look at, that would be great, as I'm not sure of what the term is to search for to get the right answer.