Error compiling TMinuit-script with ACLiC

Hi

I have tried to get this script below compile with ACLiC, but failed. I would be very greatful if anyone could get me a hint whats wrong. ROOT v4.00, Redhat 9.0

#include <TMinuit.h>

int test(void){

TMinuit *gmin = 0;

gmin = new TMinuit(3);

return 1;

}

compiled with:
.L test.C+

output:
Info in TUnixSystem::ACLiC: creating shared library /proton_home/hofverbe/SEASA/analysis/./test_C.so
dlopen error: /proton_home/hofverbe/SEASA/analysis/./test_C.so: undefined symbol: _ZN7TMinuitC1Ei
Load Error: Failed to load Dynamic link library /proton_home/hofverbe/SEASA/analysis/./test_C.so
/usr/bin/ld: warning: libstdc++.so.5, needed by /usr/local/root/lib/libGX11.so, may conflict with libstdc++.so.3
/usr/lib/crt1.o(.text+0x18): In function _start': ../sysdeps/i386/elf/start.S:77: undefined reference tomain’
/proton_home/hofverbe/SEASA/analysis/./fileF8lFo0.o(.text+0x39): In function test()': : undefined reference toTMinuit::TMinuit(int)'
collect2: ld returned 1 exit status
*** Interpreter error recovered ***

thanks!

Hi,

Autoload for ACLiC was implemented only in ROOT 4.01
In ROOT 4.00, you need to explicitly load minuit before compiling you code:

gSystem->Load("libMinuit"); .L test.C+

Cheers,
Philippe.

Thanks, it works now! But, if I want to include the loading of the library in the script, how do I do then? have tried like this (but it doesnt work):

#include <TSystem.h>
#include <TMinuit.h>

int test(void){

gSystem->Load(“libMinuit”);

TMinuit *gmin = 0;

gmin = new TMinuit(3);

return 1;

}

putput:

root [0] .L test.C++
Info in TUnixSystem::ACLiC: creating shared library /proton_home/hofverbe/SEASA/analysis/./test_C.so
dlopen error: /proton_home/hofverbe/SEASA/analysis/./test_C.so: undefined symbol: _ZN7TMinuitC1Ei
Load Error: Failed to load Dynamic link library /proton_home/hofverbe/SEASA/analysis/./test_C.so
/usr/bin/ld: warning: libstdc++.so.5, needed by /usr/local/root/lib/libGX11.so, may conflict with libstdc++.so.3
/usr/lib/crt1.o(.text+0x18): In function _start': ../sysdeps/i386/elf/start.S:77: undefined reference tomain’
/proton_home/hofverbe/SEASA/analysis/./filemzvlvo.o(.text+0x68): In function test()': : undefined reference toTMinuit::TMinuit(int)'
collect2: ld returned 1 exit status
*** Interpreter error recovered ***
root [1]

[quote]But, if I want to include the loading of the library in the script, [/quote]You can not (per se). The easiest is to use a version of ROOT newer than v4.01.
Alternatively you need 2 scripts (one additional to load the scripts). For example:

{ gSystem->Load("libMinuit"); gROOT->ProcessLine(".L test.C+"); }
Or load libMinuit in your rootlogon.C file.

Cheers,
Philippe.

Thanks for your help Philippe, I appreciate it! I solved it the rootlogon-way…