This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: template with friend function problem
- To: yelistratov at gmd dot de
- Subject: Re: template with friend function problem
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Mon, 20 Mar 2000 23:21:21 +0100
- CC: gcc at gcc dot gnu dot org
- References: <38D638B1.A1C0E542@gmd.de>
> What is wrong with my instantiation of friend functions?
In C++, at the point of instantiation, the definition of a template
function (or class) must be visible - just having the declaration is
not enough. As a result, you must define the template implementation
in the header file. This is most easily achieved by #including
Vector.C into Vector.h.
Hope this helps,
Martin