How to use TPDF in compiled programs?

Dear Experts,
good afternoon.

I’m rather new of root and I need a help to correct a (probably trivial) error of mine.
I’m trying to use TPDF to print TCanvas’es from a compiled program
but I always get a “*** Break *** segmentation violation” at the first attempt to open a PDF file (but the same
is for a postscript file).

I’m using root_5.28.00d .
My source code is in to.infn.it/~tosello/TPDF/TPDFexample.cxx and comes from the example
root.cern.ch/root/html/TPDF.html (which works fine when I launch it in an interactive root session).
The makefile that I’m using is in attachment to.infn.it/~tosello/TPDF/Make_TPDFexample
The output of my compiled program (with “Root.Debug: 7” in my ~/.rootrc) is in
to.infn.it/~tosello/TPDF/TPDFexample_out.txt

Also: I do not understand the last line of TPDFexample_out.txt :

Info in TPluginManager::FindHandler: did not find plugin for class TSystem and uri
/cern/root_5.28.00d/etc/gdb-backtrace.sh
"
since gdb-backtrace.sh seems to be there :

ls -l /cern/root_5.28.00d/etc/gdb-backtrace.sh
-rwxr-xr-x 1 flavio users 7607 2011-05-23 18:26 /cern/root_5.28.00d/etc/gdb-backtrace.sh
"

I’m afraid that I’m missing some fundamentals : can you give me a hint, please ?
Thank you very much !
With my kindest regards,

Flavio

You need a TApplication. A good example to look at is the stressGraphics program in:

$ROOTSYS/test/stressGraphics.cxx