Hi Volodja, When you compile with the native C++ compiler, a forward declaration like class TF1 is not enough. You must specify #include "TF1.h" Rene Brun babintsev@mx.ihep.su wrote: > > babintsev@mx.ihep.su, 21-FEB-2001 > > Hello rooters, > I cannot compile the script (below), where is my error ? > > root [0] .L test1.C++ > .... > invalid use of undefined type `class TF1' > .... > > //..................test............... > #include <stdlib.h> > #include <stdio.h> > #include <iostream.h> > class TF1; > Double_t fitf(Double_t *x, Double_t *par); > > Double_t fitf(Double_t *x, Double_t *par) > { > Double_t arg = 0; > > cout<<"par0= "<<par[0]<<"par1= "<<par[1]<<"par2= "<<par[2]<< "x0 = "<< > x[0] << endl; > > // if (par[2]) arg = (x[0] - par[1])/par[2]; > Float_t pp= par[2]; if (pp) arg = (x[0] - par[1])/par[2]; > > Double_t fitval = par[0]*TMath::Exp(-0.5*arg*arg); > return fitval; > } > > void test() > { > TF1 *fun = new TF1("fit",fitf,-3,3,3); > fun->SetParameters(500,0.,1.0); > fun->SetParNames("Constant","Mean_value","Sigma"); > fun->Draw(); > } > //.................... > > Volodja Babintsev
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET