Can't print value of static int variable
I want to check the value of static variable in this context.
I am using www.codechef.com/ide as IDE : C++14 (Gcc 6.3) as the Language + Compiler.
CODE:
#include <iostream>
using namespace std;
class Demo_StaticVar
{
public :
static int a;
Demo_StaticVar()
{
cout<<a<<endl;
}
};
int main()
{
Demo_StaticVar obj1;
return 0;
}
ERROR:
/home/ptnn1S/ccl6RBkR.o: In function `main':
prog.cpp:(.text.startup+0xf): undefined reference to `Demo_StaticVar::a' collect2: error: ld returned 1 exit status
Screenshot: