Hi Kalen,
You have the wrong signature for your function.
see example below
//file f1ex.C
double testfunc(double *x, double *par) {
double s;
s = sin(x[0]);
return s;
}
void f1ex() {
TF1 *f1 = new TF1("f1",testfunc,-6,6,0);
f1->Draw();
}
root > .x f1ex.C
Rene Brun
On Tue, 20 May 2003, Kalen
Martens wrote:
> Hi,
>
> I am having some difficulty in drawing a function that I have in a file.
> Here is a simple function, for example:
>
> >cat testfunc.C
>
> double testfunc(double x)
> {
> double s;
>
> s=sin(x);
>
> return s;
> }
>
> I have a more complicated function in mind, but this is simple and I get
> the same behavior.
>
> In ROOT (3.04/02), I do the following:
>
> >root
>
> Compiled for linux with thread support.
>
> CINT/ROOT C/C++ Interpreter version 5.15.68, Dec 12 2002
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .L testfunc.C
> root [1] TF1 *testf1 = new TF1("testf1", testfunc, 3., 8., 0);
> root [2] testf1 -> Draw();
> <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
> Error: G__CallFunc::SetArgArray() must be initialized with
> 'G__CallFunc::SetFunc(G__ClassInfo* cls,char* fname,char* args,long*
> poffset)' first
> root [3]
>
> I don't understand this error. I've really tried to get this to work, but
> with no avail. Can someone show me the error of my ways?
>
> Thanks,
> -Kalen
>
> -----------------------------------------------------------------
> - Kalen Martens Ph:(416)-978-6632 -
> - Dept. of Physics -
> - University of Toronto, Toronto, Canada -
> -----------------------------------------------------------------
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET