The following code
#include <iostream>
class X // fully static class
{
private:
static int x;
public:
static int get()
{
return x;
}
static void set(int i)
{
x = i;
}
};
int main()
{
X::set(3);
std::cout << X::get() << std::endl;
return 0;
}
leads to what looks like a linking problem while compiling
undefined reference to `X::x'
What is causing this problem?