I had the following class:
Code:
/*!
* \brief Provides text drawing-methods for OpenGL.
*/
class ZTextDrawer2
{
public:
/*
various stuff
..........
..........
*/
void Draw2DText(DrawPoint<float> p, const char *format, ...);
void Draw3DText(DrawPoint<float> p, const char *format, ...);
private:
/*
various stuff
..........
..........
*/
}
I had not problems with it, and it worked as it should be. Problems rised when I
decided it t change it to the following:
Code:
/*!
* \brief Provides text drawing-methods for OpenGL.
*/
class ZTextDrawer2
{
public:
/*
various stuff
..........
..........
*/
template<typename Scalar> void Draw2DText(DrawPoint<Scalar> p, const char *format, ...);
template<typename Scalar> void Draw3DText(DrawPoint<Scalar> p, const char *format, ...);
private:
/*
various stuff
..........
..........
*/
}
In both cases the class is used like that:
Code:
ZTextDrawer2::GetInstance()->Draw2DText(DrawPoint<float> (0.0f, 0.0f), "ZTextDrawer2");
The problem with the second version of the class is that I get link errors(i use GCC):
Code:
obj\test.o:test.cpp|| undefined reference to `void Z_GLC::ZTextDrawer2::Draw2DText<float>(Z_GLC::DrawPoint<float>, char const*, ...|
Why is this link error caused?