Hello, I'm new to the forum and would like some help. I am studying the use of static data into classes and the code below is returning an error ...

------------------------------------------------------------------------------------------------
#include <iostream>
using namespace std;

class REC
{
private:
static int n; //Dado que será único na classe e alterado por todos os objetos
public:
REC() {n++;} // Construtor
int getrec() const {return n;}
};

void main()
{
REC r1,r2,r3;
cout << "\nO numero de objetos de R1: " << r1.getrec();
cout << "\nO numero de objetos de R2: " << r2.getrec();
cout << "\nO numero de objetos de R3: " << r3.getrec();
}
------------------------------------------------------------------------------------

The error:
main.obj:-1: error: LNK2001: unresolved external symbol "private: static int REC::n" (?n@REC@@0HA)
Note: I'm using QT Creator