I'm learning C++ and Qt, but even the simplest code that I copy and paste from a book produces problems.
On Ubuntu 10.04, I'm using g++4.4.2 with the QtCreator IDE. 
Is there a distinction between the syntax of the g++ compiler and those of other compilers? 
When I try to access static members, for example, something always goes wrong.
#include <iostream>
using namespace std;
class A
{
   public:
      static int x;
      static int getX() {return x;}
};
int main()
{
   int A::x = 100; // error: invalid use of qualified-name 'A::x'
   cout<<A::getX(); // error: : undefined reference to 'A::x'
   return 0;
}
I believe it is the same as stated here and here (isn't it?). 
So, what's the problem with the above code?