R
Roland Raschke
Hi,
I'm a novice in using templates and want to write a static library
with some communication classes. One of these classes uses two
instances of a ringbuffer template as class members:
template <class T> class CRingBuffer
{
public:
...
bool PutData( const T& value );
...
};
typedef CRingBuffer<unsigned char> tByteFIFO;
class CCommDriver
{
...
tByteFIFO m_RxRing;
...
};
I can compile and link this library without errors, but if want to use
the class CCommDriver in an application the linker returns errors for
any used member function of CRingBuffer, i.e.:
error LNK2001: Unresolved external "public: bool __thiscall
CRingBuffer<unsigned char>:utData(unsigned char const &)"
What's the problem? I think the compiler should create the necessary
template code for unsigned byte because it is used inside the
CCommDriver class...
Thanks for your help!
Regards,
Roland
I'm a novice in using templates and want to write a static library
with some communication classes. One of these classes uses two
instances of a ringbuffer template as class members:
template <class T> class CRingBuffer
{
public:
...
bool PutData( const T& value );
...
};
typedef CRingBuffer<unsigned char> tByteFIFO;
class CCommDriver
{
...
tByteFIFO m_RxRing;
...
};
I can compile and link this library without errors, but if want to use
the class CCommDriver in an application the linker returns errors for
any used member function of CRingBuffer, i.e.:
error LNK2001: Unresolved external "public: bool __thiscall
CRingBuffer<unsigned char>:utData(unsigned char const &)"
What's the problem? I think the compiler should create the necessary
template code for unsigned byte because it is used inside the
CCommDriver class...
Thanks for your help!
Regards,
Roland