I've defined a public template function in a class called EventDispatcher
:
public:
template <class className> void AddEventListener ( className* );
The function implements like this:
template <class className>
void EventDispatcher::AddEventListener ( className* ptr )
{
};
Then in some class I create an insatnce of Timer
which is a child EventDispatcher
and call AddEventListener
:
timer->AddEventListener ( this );
After what I'm getting an error
/tmp/ccjRF7sK.o: In function `AirHockeyServer::AirHockeyServer()':
AirHockeyServer.cpp:(.text+0xa5): undefined reference to `void EventDispatcher::AddEventListener<AirHockeyServer>(AirHockeyServer*)'
/tmp/ccjRF7sK.o: In function `AirHockeyServer::AirHockeyServer()':
AirHockeyServer.cpp:(.text+0x187): undefined reference to `void EventDispatcher::AddEventListener<AirHockeyServer>(AirHockeyServer*)'
collect2: ld returned 1 exit status