I have smth like this:
template <class T, int i>
class Array
{
public:
Array( void );
~Array();
private:
//...
};
Then, when I try to create an object of this class in the main() function, I get a linker error: unresolved external symbol: ...the constructor... ...the destructor... ...all other members... Why?
Looks like this:
Array<int, 10> myArray; // This is what causes the linker error
The most interesting thing is that if I make
struct data
{
int i;
};
and then call
Array<data, 10> myArray;
eveything works.
The exact code can be found here:
template <class T, int i>
class Array
{
public:
Array( void );
~Array();
private:
//...
};
Then, when I try to create an object of this class in the main() function, I get a linker error: unresolved external symbol: ...the constructor... ...the destructor... ...all other members... Why?
Looks like this:
Array<int, 10> myArray; // This is what causes the linker error
The most interesting thing is that if I make
struct data
{
int i;
};
and then call
Array<data, 10> myArray;
eveything works.
The exact code can be found here: