Drawing canvas

Hi,
I have some problem I didn’t expect at all. I remeber before 3 months
this was working :open_mouth: and I can’t figure out what’s happening.

So with the following code I’m expecting to have an open canvas until the end of time:

#cvas.cc:
#include "TCanvas.h"

int
main ()
{
  TCanvas* c = new TCanvas ("c", "", 4);

  while (1)
    {
    }
}

but it’s not tha case…

I’m working on lxplus machine and I’m setting:

export ROOTSYS=/afs/cern.ch/sw/root/v5.02.00/slc3_gcc3.2.3/root
export PATH=/usr/bin:$ROOTSYS/bin
export LD_LIBRARY_PATH=$ROOTSYS/lib

and compiling:
g++ -o cvas cvas.cc $(root-config --cflags) $(root-config --libs)

so it compiles but ./cvas produces nothing (ofcourse the thing is working
interactively)

I know this looks silly but I’m silly. Very probably it’s not ROOT problem at all but I realy can’t figure out what to do so any ideas are welcomed :unamused:

Remove your loop that will consume all the cpu of your machine.
Call a TApplication (or TRint) object instead.
See examples of main program in the Users Guide, $ROOTSYS/test
or the ROOT main program instead.
Note that in general, it is a very bad idea to create your own main
program. Better use standard root.exe and execute a script (interpreted or compiled).

Rene

Thanks a lot it works perfectly with theApp :slight_smile: