TCanvas not produced when compiled macro

Hi,

I have a macro which produced a TCanvas with a plot. When I compile it and execute the binary the canvas is no longer shown, although I can do c.SaveAs("canvas.gif") and I obtain a correct plot. But I don't understand why the canvas is not shown just like when macro is executed. It is probably something trivial, but I cannot figure it out. Thanks for your help in advance!

      Mariusz

Probably a trivial scoping problem.
Post the shortest possible script reproducing the problem.

Rene

I attach the two:
*/ BGITest.C - root script which shows canvas
*/ BGITest.cxx - a code which I compile (with g++) and it does not display the canvas.

The root version I’m using is 5.26/00b, on SLC4 machine.

Regards, Mariusz
BGITest.cxx (1.07 KB)
BGITest.C (552 Bytes)

OK problem understood. You did not mention the important difference between your script and the compiled code. In your compiled code you implement your own main program without instantiating a TApplication object that is required when doing graphics on the screen. Instead of doing that you better use ACLIC to compile your script.
Anyhow, I have made the necessary changes in your file such that it works also with your main program.

Rene
BGITest.cxx (1.27 KB)

Thanks a lot, this was very helpful!

Mariusz