Special edition for compiled version of root macro

I have a problem in running a root macro which was compiled.
Following macro compiles without no error, but it crashes with
the segmentation violation error when it is exected the line
Asymmetry->cd(); The gDirectory->ls(); command shows
adequate directory strucuture,

TFile* rootfile.root ROOT Histogram file
KEY: TDirectory Kinema;1 Kinema
KEY: TDirectory Bunch;1 Bunch
KEY: TDirectory ErrDet;1 ErrDet
KEY: TDirectory Asymmetry;1 Asymmetry

So I think file is open properly at least, but somehow crashes
when it tried to change directory.

This macro doesn’t crashes and runs fine if I execute without
compilation on root prompt.

Any suggestions/advices are appliciated.
Thanks,

#ifndef CINT

#include
#include
#include
#include
#include
#include
#include
#include
#include “TString.h”
#include “TMath.h”

#endif

#ifndef CINT
int main(int argc, char **argv)
#else
Int_t RootMacro()
#endif
{

// Root file open
TFile * rootfile = new TFile();
rootfile->Open(“rootfile.root”);

gDirectory->ls();
Asymmetry->cd();

return 0;

}

Instead of

TFile * rootfile = new TFile(); rootfile->Open("rootfile.root");
do
TFile * rootfile = TFile::Open(“rootfile.root”); //static function!

Rene

still crashes even with TFile * rootfile = TFile::Open(“rootfile.root”);

Please read:
root.cern.ch/root/roottalk/RoottalkRules.html

Rene

Hi,

and, as a few hints while you prepare a posting that allows us to help you: you never declared Asymmetry, so I doubt the code you sent really does compile.

And you seem to be using a little Cint interactive shortcut - Cint will understand Asymmtry as “an object in the current directory called Asymmetry”. The compiler won’t. So you have to cd into it like this:rootfile->cd("Asymmetry");
Cheers, Axel.