Re: Problem compiling a program under mac os X

From: Roland Kuhn <rkuhn_at_e18.physik.tu-muenchen.de>
Date: Tue, 22 Mar 2005 11:10:48 +0100


Hi Francesco!

On Mar 22, 2005, at 12:43 AM, Francesco Perfetto wrote:

> 2) Now I woul'd like to run my programs (that I use under Linux and
> SunOS) also under my new computer (with mac os X), but when I do this
> after compilation (compilation NO PROBLEM) I have:
>
> nbkloe:~/LLHOOD_nuovometodo/val-06 francesco$ Darwin/Likelihood.exe
> Fatal in <TFile::TFile>: ROOT system not initialized
> aborting
> Abort trap
>
> There is anyone that can help me ?
>
> my program are (only a portion how example):
>
> 1) Likelihood.cpp:
>
> #include <iostream.h>
> #include "TROOT.h"
> #include "TObject.h"
> void llhood(Double_t ALFA);
>
> int main(int argc, char* argv[])
> {
> double ALFA[] = {0.};
> for(Int_t i=0; i<1; i++){
> llhood(ALFA[i]);
> }
> return 0;
> }
> 2) likelihood.cc:
>
> #define res_class_cxx
> #include "res_class.h"
> #include <iostream.h>
> #include "TH1.h"
> #include "TFile.h"
> #include "TChain.h"
>
> // GLOBAL VARIABLES THAT I MUST USE IN THE FUNCTION IN likelihood.cc
> TFile *f2 = new TFile("PROVA.root");
> TH1D *gen = new TH1D("gen" ,"gen" ,30,0,1);

You should remove these global variables, or at least initialize them from main(), since as it stands in your code it might work or not depending on the link order. Using ROOT objects before main() is executing is never a good idea... (at least in my experience)

Ciao,

                                        Roland

--
TU Muenchen, Physik-Department E18, James-Franck-Str. 85747 Garching
Telefon 089/289-12592; Telefax 089/289-12570
--
A mouse is a device used to point at
the xterm you want to type in.
Kim Alm on a.s.r.

Received on Tue Mar 22 2005 - 11:19:40 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET