P
Peter Sprenger
I have a small template problem in the CBuilder 2007.
This code is working:
template <typename T> class array
{
public:
sm_array(){}
virtual ~sm_array() {}
};
this gives no C++ but a linker error:
header:
template <typename T> class sm_array
{
public:
sm_array();
virtual ~sm_array();
};
cpp file:
template <typename T> sm_array<T>::sm_array()
{
}
template <typename T> sm_array<T>::~sm_array()
{
}
linker error:
[ILINK32 Error] Error: Unresolved external
'sm_array<int>::~sm_array<int>()' referenced from ...
[ILINK32 Error] Error: Unresolved external
'sm_array<int>::sm_array<int>()' referenced from ...
Any ideas?
Regards
Pete
This code is working:
template <typename T> class array
{
public:
sm_array(){}
virtual ~sm_array() {}
};
this gives no C++ but a linker error:
header:
template <typename T> class sm_array
{
public:
sm_array();
virtual ~sm_array();
};
cpp file:
template <typename T> sm_array<T>::sm_array()
{
}
template <typename T> sm_array<T>::~sm_array()
{
}
linker error:
[ILINK32 Error] Error: Unresolved external
'sm_array<int>::~sm_array<int>()' referenced from ...
[ILINK32 Error] Error: Unresolved external
'sm_array<int>::sm_array<int>()' referenced from ...
Any ideas?
Regards
Pete