Compile problem in Math/ParamFunctor.h

I am upgrading our software to the most recent version of root and now the compile fails with the following messages:

g++ -g -O0 -pipe -m32 -Wall -W -Woverloaded-virtual -fPIC -Iinclude -DSWAP_BYTES -DUSE_GETTIMEOFDAY -DUSE_PTHREAD -DIGNORE_DISP_ERRORS -DFORTRAN_UNDERSCORE -I/usr/local/root_v5.19_04/include -o qsigex/QSigExGaussCor.o -c qsigex/QSigExGaussCor.cxx qsigex/QSigExDis.h:49: warning: unused parameter ‘x’ qsigex/QTTreeUtils.h:13: warning: ‘class QTTreeUtils’ has virtual functions but non-virtual destructor qsigex/QSigExGaussCor.cxx: In member function ‘virtual Int_t QSigExGaussCor::Get()’: qsigex/QSigExGaussCor.cxx:231: warning: passing NULL to non-pointer argument 1 of ‘void TF1::SetFunction(Func) [with Func = int]’ /usr/local/root_v5.19_04/include/Math/ParamFunctor.h: In static member function ‘static double ROOT::Math::ParamFunctorHandler<ParentFunctor, Func>::FuncEvaluator<F>::Eval(F&, double*, double*) [with F = int, ParentFunctor = ROOT::Math::ParamFunctor, Func = int]’: /usr/local/root_v5.19_04/include/Math/ParamFunctor.h:88: instantiated from ‘double ROOT::Math::ParamFunctorHandler<ParentFunctor, Func>::operator()(double*, double*) [with ParentFunctor = ROOT::Math::ParamFunctor, Func = int]’ qsigex/QSigExGaussCor.cxx:403: instantiated from here /usr/local/root_v5.19_04/include/Math/ParamFunctor.h:104: error: ‘f’ cannot be used as a function make: *** [qsigex/QSigExGaussCor.o] Error 1

(Ignoring the warnings and concentrating on the error…)

I can’t see anywhere in our code that includes ParamFunctor.h. I regressed backward through root versions to determine roughly when this error was introduced. The error happens for root 5.20.00 and 5.19.04, but version 5.18.00 is OK.

If it helps, here is the code around line 403 in qsigex/QSigExGaussCor.cxx:

void QSigExGaussCor::CheckPDFs() const { //This protected function check if "PDFs" TDirectory exists if(!FindObjKey("PDFs",fMyDir)){ cout << "Error: There's no PDF in fMyDir\n"; throw 1; } // <<< this is line 403 }

And the output of “uname -a” in case it helps:

Any help would be appreciated. I don’t know where to start with this one.

TIA

  • Phil

Hi,

from the error message I see you are using the method TF1::SetFunction passing an integer variable. This is not allowed.
You should pass a C function pointer or a C++ functor with the right signatures. See

root.cern.ch/root/htmldoc/TF1.html#F3

or

root.cern.ch/root/htmldoc/TF1.html#F4

Best Regards

Lorenzo

Thanks! I guess I shouldn’t have been ignoring the warnings.