Re: template compile errors

From: David Hilsee (davidhilseenews_at_yahoo.com)
Date: 10/13/04


Date: Tue, 12 Oct 2004 23:59:33 -0400


"Thomi Richards" <thomi@thomi.imail.net.nz> wrote in message
news:dc357c8b.0410121828.65f0b4bc@posting.google.com...
> Hi,
>
>
> I'm trying to create a simple stack class using C++ and templates.
> Everything works well and good if I amke the class totally inline.
> However, as soon as I try to seperate the class into a .h and a .cpp
> file, gcc throws some strange linking errors.
> [...]
> I'm tearing my hair out... why would it not work in seperate files? My
> class definition is something like this:
> [...]

See the FAQ (http://www.parashift.com/c++-faq-lite/), section 34 ("Container
classes and templates"), question 12 ("Why can't I separate the definition
of my templates class from it's declaration and put it inside a .cpp file?")
and the related questions that follow.

-- 
David Hilsee