Can't save canvas in compiled cpp

hi,
I have a cpp file .I have no problem when complied it, but When I run the exe . it reports gif can’t be saved in batch model when exe the statement “c->Save(“my.gif”)” in the exe .Then I change the statement of "c->Save(“my.gif”) " and save the canvas to other format,such as pdf.ps.eps.png.etc.But When I run the it again , it reports

*** Break *** segmentation violation
Generating stack trace…
0x42028c48 in from ./iqmd_ana.out
0x413f34ad in THistPainter::PaintStat(int, TF1*) + 0xf79 from /home/caoxiguang/root/lib/libHistPainter.so
0x413e6f90 in THistPainter::Paint(char const*) + 0x7ac from /home/caoxiguang/root/lib/libHistPainter.so 0x409cae6b in TH1::Paint(char const*) + 0x4b from /home/caoxiguang/root/lib/libHist.so
0x40e7b18b in TPad::Paint(char const*) + 0xc1 from /home/caoxiguang/root/lib/libGpad.so
0x40e7b18b in TPad::Paint(char const*) + 0xc1 from /home/caoxiguang/root/lib/libGpad.so
0x40e5ea23 in TCanvas::Paint(char const*) + 0x2f from /home/caoxiguang/root/lib/libGpad.so
0x40e7f0c5 in TPad::Print(char const*, char const*) + 0xab3 from /home/caoxiguang/root/lib/libGpad.so
0x40e7ff9f in TPad::SaveAs(char const*) + 0x277 from /home/caoxiguang/root/lib/libGpad.so
0x0804a54c in energy_spec_his() + 0x11b6 from ./iqmd_ana.out
0x0804938f in main + 0x15 from ./iqmd_ana.out
0x420158d4 in __libc_start_main + 0xa4 from ./iqmd_ana.out
0x08048e15 in operator new(unsigned) + 0x31 from ./iqmd_ana.out
Aborted

My root version is 4.00

Is there someone have met the problem before ?
Any suggestions is appreciated
Thanks in advance!

Move to a more recent version, eg 5.17/08

Rene

You are right. I have solve the problem by using a more recent version 5.11 of root
Thanks very much !