473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Curious Error I Cannot Figure Out (templates)

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,
std::basic_string<char, std::char_traits<char>, std::allocator<char
>::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 ...
}

Aug 16 '06 #1
1 1259
mieskola wrote:
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,
std::basic_string<char, std::char_traits<char>, std::allocator<char
::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 ...
}
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/ho...t.html#faq-5.8

Cheers! --M

Aug 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Simon | last post by:
Hi, I'm having a problem with templates and specialisation. I'm using it to overload the same function so it can return different things. I can't see what I'm doing wrong, although my compiler...
5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
0
by: ckhoge | last post by:
Hi, Consider this code fragment, based on the article "Using Chains to Free Library Code" from the July 2005 issue of C/C++ Users Journal: -- begin listing -- template <class T> struct Foo...
4
by: Aaron Walker | last post by:
Greetings, I'm attempting to write my first *real* template function that also deals with a map of strings to member function pointers that is making the syntax a little tricky to get right. ...
3
by: CoreyWhite | last post by:
I wrote a program that shows some incredibly curious probabilities. It is a simple game where you guess a number between 0 and 2 that the computer thinks up. What is origonal about this game is...
5
by: Mark | last post by:
Sorry for creating such a newbish topic, but I just can't seem to figure out what the problem is here. // main.cpp #include <cstdlib> #include <iostream> #include "Vector.h" using namespace...
34
by: chandu | last post by:
Hello every body , upto now i saw advantages of C# only,i am curious about what are the disadvantages of C#..(because any programming language should have some positives and negatives..) Thanks...
8
by: kevin | last post by:
Hello! So I was reading O'Reilly's C++ in a Nutshell when I came accross something interesting: The class definition for basic_ostream contains numerous overloaded operator<< functions: ...
0
by: JRough | last post by:
On Sep 26, 3:23 pm, Captain Paralytic <paul_laut...@yahoo.comwrote: without the exit I get this again: Warning: Cannot modify header information - headers already sent by (output started at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.