Hi Martin, you did not export the friend functions to the interpreter via a LinkDef.h file. Remember, friends are no class member functions. Add to the LinkDef: #pragma link C++ function operator+(const V3D&,const V3D&); Cheers, Fons. martin wrote: > > dear rooters, > i made a simple vector class which i implemented in root via rootcint. > everithing wokes fine exept that i can't define (override) any > operators. > example: > > in V3D.h : > friend V3D operator+(const V3D &v ,const V3D &w); > > in V3D.C : > V3D operator + (const V3D &v, const V3D &w) > { V3D r=V3D(v.GetX()+w.GetX(), v.GetY()+w.GetY(), v.GetZ()+w.GetZ()); > return r; > } > > when i now do: > V3D peter; > const V3D paul(1,2,3); > const V3D nmary(10,10,10); > everithing is ok, but : > > peter = paul + nmary; > Error: operator+ not defined for V3D > FILE:/data_fck/schulte/root/Rummspiel/Linking/./test+.C LINE:6 > *** Interpreter error recovered *** > > what seems strange, is that compilation an linking works whithout > errors. all other defined funktions work well. > > so, is it a bug or do i do something stupid? > > thank you. -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET