Fatal in <TClass::TClass>: ROOT system not initialized
aborting
Fatal in <TClass::TClass>: ROOT system not initialized
aborting
....
The code is:
#include <iostream.h>
#include "TROOT.h"
#include "TOrdCollection.h"
#include "TH1.h"
int main()
{
TROOT root("name","title");
TOrdCollection * coll = new TOrdCollection(3);
TH1D* h1 = new TH1D("name1","title1",100,0.0,500.0);
TH1D* h2 = new TH1D("name2","title2",100,0.0,500.0);
coll->AddLast(h1);
coll->AddLast(h2);
TOrdCollectionIter iter(coll);
cout<<((TNamed*)iter.Next())->GetName()<<endl;
cout<<((TNamed*)iter.Next())->GetName()<<endl;
if (iter.Next() == 0) cout << "yes" << endl;
return 0;
}
If I comment out the three lines with cout in them, I don't get any
errors. This is all on Windows NT under MS VC++ 6.0. If I compile and
run on Unix (SGI), I don't get any problems either way. Am I missing
something?