Curious Error I Cannot Figure Out (templates)

M

mieskola

Below, I posted the error, the function call that generated the error,
and the function itself. I have been spinning my wheels trying to
figure this out. The source files compile, just generating a test
executable fails. This code works on on a Digital UNIX machine, but
fails while I am trying to port to Linux.

Thanks.



ERROR:
------------

someFile.C:83: undefined reference to `MsgRouter<int,
::Register(int const&, MsgHandler<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >*)'


CALLING POINT:
------------------------

someFile.C -> LINE 82: MsgCatcher lCatcher;
someFile.C -> LINE 83: msgRouter.Register(1, &lCatcher);

where MsgCatcher is defined as: class MsgCatcher : public
MsgHandler<string> {..}


FUNCTION:
-----------------

template<class KeyType, class MsgType>
void MsgRouter<KeyType, MsgType>::
Register(const KeyType &ipKey, MsgHandler<MsgType> *ipHandler)
{
// some code here ...
}
 
M

mlimber

mieskola said:
Below, I posted the error, the function call that generated the error,
and the function itself. I have been spinning my wheels trying to
figure this out. The source files compile, just generating a test
executable fails. This code works on on a Digital UNIX machine, but
fails while I am trying to port to Linux.

Thanks.



ERROR:
------------

someFile.C:83: undefined reference to `MsgRouter<int,



CALLING POINT:
------------------------

someFile.C -> LINE 82: MsgCatcher lCatcher;
someFile.C -> LINE 83: msgRouter.Register(1, &lCatcher);

where MsgCatcher is defined as: class MsgCatcher : public
MsgHandler<string> {..}


FUNCTION:
-----------------

template<class KeyType, class MsgType>
void MsgRouter<KeyType, MsgType>::
Register(const KeyType &ipKey, MsgHandler<MsgType> *ipHandler)
{
// some code here ...
}

Please try to reduce your code to a minimal but complete sample that
generates the error and that we can cut-and-paste *unedited* into our
editors. See the posting guidelines for code here:

http://parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top