Hi Alex,
A program using Root must initialize the Root system.
See the two missing lines in your code below.
I suggest you look at the many examples given in
$ROOTSYS/test. See for example hsimple.cxx and the way
to link in $ROOTSYS/test/Makefile.
All that is also explained in the Users Guide
http://root.cern.ch/root/RootDoc.html
Rene Brun
On Wed, 21 Feb 2001, Alex Kim wrote:
> Hello all,
>
> I just started playing with ROOT yesterday so maybe my question has a
> trivial solution. I get a runtime error with the following code, a
> segmentation fault. xxgdb gives
>
> #0 0x4061774b in TH1::UseCurrentStyle ()
> from /home/lilys/akim/root/lib/libHist.so
>
> My source looks like
>
> #include <iostream.h>
> #include "TH1.h"
#include "TROOT.h" <======
>
> int main(){
TROOT simple("simple","my first Root program"); //<==========
>
> Int_t nbin=100;
> Axis_t xlow=-3.3;
> Axis_t xup=4.;
>
> TH1F* h1 = new TH1F("h1","h1 title",nbin,xlow,xup);
> }
>
> I am using Version 3.00/05
>
> Any ideas as to what Iam doing wrong? Thanks in advance,
>
> Alex Kim
>
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET