Steve and Rene, The limitation is obvious that there is a function definition in { } style macro. There are 2 kinds of macros in ROOT/CINT. C++ style macro accepts function definition, however { } style macro does not. Problem is that you have extra { } outside. if ROOT/CINT sees '{' as the first non-comment character in a file, it is interpreted as { } style macro. If you take out { } , it will work fine. Thank you Masaharu Goto ======================================================================= Hi Steve, Again, you show only a subset of your code. Your function is correct. My guess is that this function is embedded into a piece of code following the function calling it. In this case you must define a function prototype at the beginning of your macro. See example of an FCN function for TMinuit in $ROOTSYS/test/minexam.cxx Rene Brun Steve Udriot wrote: > > Good morning, > > Concerning the "limitation" problem is attached here a macro which > defines a function from the "Example of a Program to fit non-equidistant > data points". > Note that the "limitation" problem disappears when I define the function > "extern", but this should not be a proper solution... > > I hope You will help me out of this! > > A nice day to everybody, > > Steve > > ------------------------------------------------------------------------ > { > > Float_t z[5],x[5],y[5],errorz[5]; > > //____________________________________________________________________________ _ _ > void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag ) > { > const Int_t nbins = 5; > Int_t i; > > //calculate chisquare > Double_t chisq = 0; > Double_t delta; > for (i=0;i<nbins; i++) { > delta = (z[i]-func(x[i],y[i],par))/errorz[i]; > chisq += delta*delta; > } > f = chisq; > } > > }
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET