Seg. violation when trying to fit a Graph in an executable

I have a problem when I try to fit a graph in an executable, it gives me
the error message

0x40b98559 in TGraph::Fit(TF1*, char const*, char const*, double, double)

  • 0x7a5 from /app/cern/root/lib/libGraf.so
    0x08048cbf in main + 0xdf from ./Fit
    0x4180fb10 in __libc_start_main + 0xe0 from /lib/tls/libc.so.6
    0x08048b01 in __gxx_personality_v0 + 0x8d from ./Fit

If I do it interactivley it works.

The cpp programm is attached.

The used Root version is
Version 4.04/02

Thanks
Fit.cpp (706 Bytes)

You forgot to include a TApplication object into your main program.
See attached file

Rene
Fit.cpp (730 Bytes)