[ROOT] Visual C++ and getting TTree from TFile

From: Damien PRIEUR (prieur@lapp.in2p3.fr)
Date: Thu May 06 2004 - 19:54:33 MEST


Hello,

I am using Root 4.00/03 compiled with win32gdk on a Win XP system.
I am executing a self compiled program (using visual c++ 6)that basicaly
open an already existing file and get a TTree from it:

//
#include <string.h>
#include <stdlib.h>
#include <Riostream.h>
#include <stddef.h>
#include "TROOT.h"
#include "TApplication.h"
#include "TH1.h"
#include "TTree.h"
#include "TFile.h"

#define INPUTFILE "c:/lxplus/scratch0/Neutralino_000004_1_100000.root"
int main(int argc, char* argv[])
{
	TH1F h1("h1","h1",10,0,10);
	TFile f(INPUTFILE);
	f.ls();
	f.cd("CBNT");
	gDirectory->ls();
	TTree* t1=(TTree*) gDirectory->Get("t3333");
	return 0;
}

The code compile fine without errors messages, but when I execute it I get
the following errors and I cannot access the tree stored in the file:

>Warning in <TClass::TClass>: no dictionary for class TTree is available
>Warning in <TClass::TClass>: no dictionary for class TBranch is available
>Warning in <TClass::TClass>: no dictionary for class TLeafI is available
>Warning in <TClass::TClass>: no dictionary for class TLeaf is available
>Warning in <TClass::TClass>: no dictionary for class TLeafF is available
>TFile**         c:/lxplus/scratch0/Neutralino_000004_1_100000.root      Athena Trees
> TFile*         c:/lxplus/scratch0/Neutralino_000004_1_100000.root      Athena Trees
>  KEY: TDirectory       Atlfast;1       Atlfast
>  KEY: TDirectory       CBNT;1  CBNT
>TDirectory*             CBNT    CBNT
> KEY: TTree     t3333;1 Combined Ntuple
>Error in <TBuffer::CheckByteCount>: object of class TNamed read too few
>bytes: 26 instead of 1077290


At the link stage, I have specified the following libraries:
libCore.lib libCint.lib libHist.lib libGraf.lib libGraf3d.lib libGpad.lib
libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib

I've found in the roottalk database mails from peoples that were having
such error messages (on MacOSX) but I was not able to find a solution from
these.
I am just starting using visual c++ and I am not an expert. Have I
missed something evident ?

Thanks in advance,
Damien.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET