That looks like the problem - I wasn't including the
templated source at the end of the .h file.
It raises
a question for me though - for my template classes,
I previously had a MyFile.H file (with no included source
at the end) and a MyFile.C file which included MyFile.H
at the start and then had the source code for the methods.
I would then compile MyFile.C as though it were
any other source file, and link together object files
for template and non-template classes to make an executable.
I was working on SGI IRIX and the SGI prelinker
took care of all the required template
instantiations when making the executable.
But if MyFile.H includes MyFile.C, this seems to require a
different approach. Do I still compile MyFile.C as
a stand-alone file at some stage? Or how do things
work when the source is included in the header file?
(I'm trying to understand what my Makefile should look
like).
Also is this inclusion of the template source in
the header file something that is specifically
need for g++, or is it something that's used generally?
Thanks again,
Paul.
Nathan Meyers writes:
>
> You answered my point of curiosity about where the reference was coming
> from... it's one of your templated classes referenced from within your
> code. The only thing that springs to mind is to ask whether you're
> following the conventions for supplying templated source code. It needs
> to come from the .h file in which the declarations are made -- a common
> technique is to include a nearby source file. You can see an example in
> /usr/include/g++-2/std/bastring.h, which declares the classes, and
> includes (at the end) bastring.cc which provides all of the templated
> source.
>
> ...
>
> Nathan
>
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]