I have a non-template class, with a static data member, nested inside a class template. I initialized the static data member as shown below, but it produces a compilation error. (I am using Visual.Net.) I wonder if anyone might
offer a solution? I would be very grateful.
template <class X>
class A
{ private:
class B
{ public:
static int item;
.
.
};
};
template <class X>
int A<X>::B::item = 3;
error LNK2001: unresolved external symbol "public: static int A<class
double>::B::item" (?item@B@?$A@Vdouble@@@@2HA)
offer a solution? I would be very grateful.
template <class X>
class A
{ private:
class B
{ public:
static int item;
.
.
};
};
template <class X>
int A<X>::B::item = 3;
error LNK2001: unresolved external symbol "public: static int A<class
double>::B::item" (?item@B@?$A@Vdouble@@@@2HA)