Compiling ROOT scripts with the g (i.e. gMinunit) objects

Hi. I am trying to compile a ROOT script that works fine from the CINT environment.
When trying to GNUmake the script, this is how it looks:

[quote]g++ -O -Wall -fPIC -pthread -I/home/apps/root/include -c histofit.cxx
g++ -O histofit.o -L/home/apps/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread -lm -ldl -rdynamic -o histofit
histofit.o(.text+0x1117): In function histofit()': : undefined reference togMinuit’
collect2: ld returned 1 exit status[/quote]

from this I understand that the linker don’t know how to access the gMinuit (gStyle, gDirectory ect’), which are accessible from CINT.
How do i solve this?

P.S. The whole script is attached. It deals with fitting a (muSR) TH1F* N_l, to a model given by TF1* fitfunc. I access and save the fit results with gMinuit. At it involves many MIGRAD minimizations, In order to make it run faster I would like it to compile.

Thanks in advance,
histofit.cxx (6.15 KB)

Hi,

just remove your main() and run.x histofit.cxx+ from within ROOT. There’s no need to write Makefiles, get the link line and compiler flags right - use ACLiC instead. See the users guide for more info.

Cheers, Axel.

Thanks