The TFile::MakeProject method does not prepend stl objects such as vector or string with std:: in the generated code. This was not a problem before (in ROOT 5 ) , but at some point the statement “using namespace std;” was removed from Riostream.h. This means that the generated code will now not compile. I am currently using ROOT 6.20.04.
It seems to me that all relevant TFile::MakeProject
(automatically) generated files contain something like this: “namespace std {} using namespace std;
” (or that: “using namespace std;
”).
@pcanal Actually, it seems to me that the origin of the problem is that the “std::
” was removed at the TTree
creation time (i.e. if you try “tree->Print();
”, you will see that it is not there). It seems to me that this is a long-standing problem which should be fixed (i.e. “std::
” should be preserved).
I don’t understand your comment. None of the header files that I get which are generated by MakeProject contain any “using namespace std” directive. It is also true that the when using TTree->Print() the std:: is missing. This was also true under ROOT 5. What changed was removing it from Riostream.h.
Well, I tried (and it seems to compile and work fine):
[...]$ root some_file.root
root [1] gFile->MakeProject("trial", "*", "recreate++");
root [2] .!grep using trial/*.[hHcC]*
That is true. However we have a large number of programs in my collaboration which include the autogenerated header file ProjectHeaders.h and which now will not build. I will either have to patch Riostream.h or the …ProjectHeaders.h file.
Well, the “proper fix” would be to modify the “ProjectHeaders.h” file. See:
cmt co highland2/oaAnalysisReader # HEAD (v2r16 or newer)
less highland2/oaAnalysisReader/*/src/createProd.py # Dashing, no?
I was planning to do something like that, namely prepend the missing line into the ProjectHeaders.h file as a workaround. However this is meant to be a ROOT forum not a T2K one!
This is now tracked as an issue.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.