[PD-dev] C++ templates - question

Thomas Grill gr at grrrr.org
Wed Oct 13 11:39:47 CEST 2004


> > are you sure the gcc compiler can handle template code to be compiled in
> > separate object files?
> > I would try to include the TPDContainer.cpp into TPDContainer.h, just as
> for
> > NT defined. (line 122)
>
> I tried this, but then I get all the errors like "redifinition of ..." for
> each method!

I'm not sure why this happens - i'm using templates all the time, and i find
the easiest solution to write all the implementations inside the class
declaration, like in

template<class T>
class hula
{
    public:
    hula(): a(0) {}
    T plus(T b) { return a+b; }
    private:
    T a;
};

all the best,
Thomas





More information about the Pd-dev mailing list