Hello,
I am trying to create a TF1 using a member function of a general c++ class, as specified here: http://root.cern.ch/root/html/TF1.html#F5
The documentation (see link above) claims that
However, when I attempt to do this
[code]#include “TF1.h”
class Simple {
public:
double Evaluate(double* x, double* p) {
return 0;
}
};
void simple_func() {
Simple s;
TF1* ff=new TF1(“ff”,s,&Simple::Evaluate,0,1,0,“Simple”,“Evaluate”);
}[/code]
it gives the following compile errors:
root [5] .x simple_func.C++
Info in <TUnixSystem::ACLiC>: creating shared library /nfs/user/jjc385/met_project/aleko_code/metsig/./simple_func_C.so
In file included from /nfs/user/jjc385/met_project/aleko_code/metsig/simple_func_C_ACLiC_dict.h:34,
from /nfs/user/jjc385/met_project/aleko_code/metsig/simple_func_C_ACLiC_dict.cxx:17:
/nfs/user/jjc385/met_project/aleko_code/metsig/./simple_func.C:6: warning: unused parameter âxâ
/nfs/user/jjc385/met_project/aleko_code/metsig/./simple_func.C:6: warning: unused parameter âpâ
/nfs/user/jjc385/met_project/aleko_code/metsig/./simple_func.C: In function âvoid simple_func()â:
/nfs/user/jjc385/met_project/aleko_code/metsig/./simple_func.C:14: warning: unused variable âffâ
In file included from /cdat/tem/jjc385/root/root_build2//include/root/TF1.h:40,
from /nfs/user/jjc385/met_project/aleko_code/metsig/./simple_func.C:1,
from /nfs/user/jjc385/met_project/aleko_code/metsig/simple_func_C_ACLiC_dict.h:34,
from /nfs/user/jjc385/met_project/aleko_code/metsig/simple_func_C_ACLiC_dict.cxx:17:
/cdat/tem/jjc385/root/root_build2//include/root/Math/ParamFunctor.h: In member function âdouble ROOT::Math::ParamMemFunHandler<ParentFunctor, PointerToObj, PointerToMemFn>::operator()(double*, double*) [with ParentFunctor = ROOT::Math::ParamFunctor, PointerToObj = Simple, PointerToMemFn = double (Simple::*)(double*, double*)]â:
/nfs/user/jjc385/met_project/aleko_code/metsig/simple_func_C_ACLiC_dict.cxx:524: instantiated from here
/cdat/tem/jjc385/root/root_build2//include/root/Math/ParamFunctor.h:175: error: no match for âoperator*â in â*((ROOT::Math::ParamMemFunHandler<ROOT::Math::ParamFunctor, Simple, double (Simple::*)(double*, double*)>*)this)->ROOT::Math::ParamMemFunHandler<ROOT::Math::ParamFunctor, Simple, double (Simple::*)(double*, double*)>::fObjâ
g++: /nfs/user/jjc385/met_project/aleko_code/metsig/simple_func_C_ACLiC_dict.o: No such file or directory
Error in <ACLiC>: Compilation failed!
Error: Function simple_func() is not defined in current scope :0:
*** Interpreter error recovered ***
I don’t understand why it’s looking for Simple::operator*.
I’m using ROOT Version 5.34.09, on a 64-bit SL6 system.
Thanks,
-Jared