In a class .h and .C file, I define a useful function as such:
pair<Double_t,Double_t> wire_coords(Int_t N)
{
Int_t SL = N/7;
Int_t ISL = N % 7;
Int_t UL = ISL > 3;
Int_t IL = ISL % 4;
pair<Int_t,Int_t> p;
p.first = -2.1+(UL+IL)*1.4;
p.second = 4.9-SL*2.8-UL*1.4;
return p;
}
Unfortunately I had misspelled one of the “Double_t” template types as “double_t” in the .C file (but not in the .h file). The error message yielded when trying to .L foo.C++ the file was this:
root [1] .L MydaqT.C++
Info in <TUnixSystem::ACLiC>: creating shared library /Users/jfcaron/Projects/Proto2BeamTest2/./MydaqT_C.so
Error: Symbol double_t second is not defined in current scope /opt/local/lib/root/cint/cint/lib/prec_stl/utility:19:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing /Users/jfcaron/Projects/Proto2BeamTest2/MydaqT_C_ACLiC_dict.cxx /Users/jfcaron/Projects/Proto2BeamTest2/MydaqT_C_ACLiC_dict.h !!!
Error: /opt/local/bin/rootcint: error loading headers...
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity
Info in <ACLiC>: The compiler has not found any problem with your macro.
Probably your macro uses something rootcint can't parse.
Check http://root.cern.ch/viewvc/trunk/cint/doc/limitati.txt for Cint's limitations.
I am glad that my code was very simple and I was able to spot the lower-case d, but from ACLiC I would normally expect more useful error messages. When the misspelling was in both .C and .h files, I get for example:
Error: /opt/local/bin/rootcint: error loading headers...
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity
In file included from /Users/jfcaron/Projects/Proto2BeamTest2/./MydaqT.C:3:
/Users/jfcaron/Projects/Proto2BeamTest2/MydaqT.h:22:20: error: use of undeclared identifier 'double_t'; did you mean 'Double_t'?
std::pair<Double_t,double_t> wire_coords(Int_t N);
^
/Users/jfcaron/Projects/Proto2BeamTest2/./MydaqT.C:334:25: error: functions that differ only in their return type cannot be overloaded
pair<Double_t,double_t> wire_coords(Int_t N)
^
/Users/jfcaron/Projects/Proto2BeamTest2/MydaqT.h:22:30: note: previous declaration is here
std::pair<Double_t,double_t> wire_coords(Int_t N);
^
So clearly the compiler is able to notice the problem, but when I accidentally fixed it only in the .h file, it gave useless messages. Is this some inherent limitation that will be fixed by the eventual ROOT 6? Is it a particular problem with std containers and ROOT _t types?
Jean-François