Hi there,
I’m trying to move to ROOT6 but I’m experiencing some “call to ‘XXX’ ambiguous” errors I don’t understand.
Below’s a MWE working with ROOT5
https://root.cern.ch/download/root_v5.34.36.Linux-centos7-x86_64-gcc4.8.tar.gz
but not with ROOT6
https://root.cern.ch/download/root_v6.16.00.Linux-centos7-x86_64-gcc4.8.tar.gz
>> .L mylib.cpp+
>> .x ztest.cpp
- mylib.hpp (master library header)
#include <TString.h>
void MyPrintFunction ( const TString & message ) ;
void MyPrintFunctionWithAnOptionalArgument ( const TString & message, const TString & extra="xxx" ) ;
- mylib.cpp (master library source)
#include "mylib.hpp"
void MyPrintFunction ( const TString & message )
{
TString textToBeDisplayed = TString::Format("\n>> %s\n",message.Data()) ;
printf ("%s",textToBeDisplayed.Data()) ; fflush (stdout) ;
return ;
}
void MyPrintFunctionWithAnOptionalArgument ( const TString & message, const TString & extra )
{
TString textToBeDisplayed = TString::Format("\n>> %s [%s]\n",message.Data(),extra.Data()) ;
printf ("%s",textToBeDisplayed.Data()) ; fflush (stdout) ;
return ;
}
- ztest.cpp (a function calling the master library)
#include "mylib.hpp"
void ztest ()
{
MyPrintFunction ("ok") ;
MyPrintFunctionWithAnOptionalArgument ("ok") ;
TString message = "test" ;
MyPrintFunction (TString::Format("message='%s'",message.Data())) ;
MyPrintFunctionWithAnOptionalArgument (TString::Format("message='%s'",message.Data())) ; /// error: call to 'MyPrintFunctionWithAnOptionalArgument' is ambiguous
MyPrintFunctionWithAnOptionalArgument (TString::Format("message='%s'",message.Data()).Data()) ; /// no error in this case...
return ;
}
Any clue?
Cheers,
M