Given this program (test.C):
#include
#include
#include <TString.h>
using namespace std;
int main(){
ofstream ftxt(“my_output_file”);
return 1;
}
and compiling ON SLC3 with:
“g++ -c -I$ROOTSYS/include -finline-functions test.C”
gives compilation errors. Just dropping the TString include statement solves the problem. Is this a feature or a bug? The problem does not show up in CERN Redhat7.3 versions for instance. Needless to say that we need to switch on inline-functions and use ROOT at the same time.
Here it is the exact error report:
/usr/include/c++/3.2.3/bits/fstream.tcc: In member function _Traits::pos_type std::basic_filebuf<_CharT, _Traits>::seekoff(_Traits::off_type, std::_Ios_Seekdir, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]': /usr/include/c++/3.2.3/bits/fstream.tcc:95: instantiated from
std::basic_filebuf<_CharT, _Traits>* std::basic_filebuf<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits]’
/usr/include/c++/3.2.3/fstream:466: instantiated from void std::basic_ofstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]' /usr/include/c++/3.2.3/fstream:432: instantiated from
std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits]‘
hula.C:7: instantiated from here
/usr/include/c++/3.2.3/bits/fstream.tcc:454: ambiguous overload for `
std::streampos& + char* const&’ operator
/usr/include/c++/3.2.3/bits/fstream.tcc:454: candidates are: operator+(int,
char*)
/usr/include/c++/3.2.3/bits/fpos.h:87: std::fpos<_StateT>
std::fpos<_StateT>::operator+(long int) [with _StateT = mbstate_t]
/afs/cern.ch/exp/ams/Offline/root/Linux/pro/include/TString.h:177:
TString operator+(long unsigned int, const TString&)
/afs/cern.ch/exp/ams/Offline/root/Linux/pro/include/TString.h:176:
TString operator+(long int, const TString&)
/afs/cern.ch/exp/ams/Offline/root/Linux/pro/include/TString.h:175:
TString operator+(char, const TString&)
/afs/cern.ch/exp/ams/Offline/root/Linux/pro/include/TString.h:171:
TString operator+(const char*, const TString&)
*** Juan ***