compiler happy but undefined symbol in GCC
Can someone please explain how to correct this code which is getting an error when build with gcc
==
Code:
template <class T> class Test {
public:
class SubClass {
public:
SubClass() : i(1) {}
int i;
};
static SubClass statics;
};
template<> Test<int> :: SubClass Test<int> :: statics;
int main(int argc, char* const argv[])
{
int j = Test<int> :: statics.i;
return 0;
}
==
error message from gcc is
C:\Users\Roger\AppData\Local\Temp/cc0oeaaa.o:bug3.cpp:(.text+0x17):
undefined reference to `Test<int>::statics'