[ROOT] Compiling a class in a macro

From: Lucia Masetti (lucia.masetti@cern.ch)
Date: Tue May 06 2003 - 15:41:31 MEST


Hello,
I have a class (generated with MakeClass) in the file CheckKe4.C, which I 
would like to use in the following macro:

----------------------
{
gSystem->Load("libPhysics.so");
gSystem->Load("libKe4Event.so");
gSystem->SetIncludePath("/afs/cern.ch/user/m/masettil/private/Ke4/treelib/");
gROOT->LoadMacro("CheckKe4.C+");
CheckKe4 a;
TChain *ch = new TChain ("Ke4Tree");
ch->Add("gold*.root");
a.Init(ch);
a.Loop();
}
----------------------

If I try to execute this macro when no file CheckKe4_C.so exists, I get the 
following error:

-----------------
Info in <TUnixSystem::ACLiC>: creating shared library 
/afs/cern.ch/user/m/masettil/private/Ke4/reader/outdir/rootcode/CheckK
e4_C.so
Error: cannot open file 
"-I/afs/cern.ch/sw/root/v3.05.04/rh73_gcc296/root//include"  FILE: LINE:0
!!!Removing 
/afs/cern.ch/user/m/masettil/private/Ke4/reader/outdir/rootcode/fileF9YdRN.cxx 
/afs/cern.ch/user/m/masettil/priv
ate/Ke4/reader/outdir/rootcode/fileF9YdRN.h !!!
Error: rootcint: failed to open 
/afs/cern.ch/user/m/masettil/private/Ke4/reader/
outdir/rootcode/fileF9YdRN.cxx in ReplaceBundleInDict()
/afs/cern.ch/user/m/masettil/private/Ke4/reader/outdir/rootcode/fileF9YdRN.cxx:13:24: 
fileF9YdRN.h: No such file or director
y
In file included from 
/afs/cern.ch/user/m/masettil/private/Ke4/reader/outdir/rootcode/fileF9YdRN.cxx:26:
/afs/cern.ch/sw/root/v3.05.04/rh73_gcc296/root/include/RtypesImp.h:16:2: 
#error RtypesImp.h should only be included by ROOT
dictionaries.
In file included from 
/afs/cern.ch/user/m/masettil/private/Ke4/reader/outdir/rootcode/fileF9YdRN.cxx:26:
/afs/cern.ch/sw/root/v3.05.04/rh73_gcc296/root/include/RtypesImp.h: In 
function `void
ROOT::GenericShowMembers (const char *, void *, TMemberInspector &, char *, 
bool)':
/afs/cern.ch/sw/root/v3.05.04/rh73_gcc296/root/include/RtypesImp.h:38: `gROOT' 
undeclared (first use
this function)
/afs/cern.ch/sw/root/v3.05.04/rh73_gcc296/root/include/RtypesImp.h:38: (Each 
undeclared identifier is
reported only once for each function it appears in.)
g++: 
/afs/cern.ch/user/m/masettil/private/Ke4/reader/outdir/rootcode/fileF9YdRN.o: 
No such file or directory
Error in <ACLiC>: Compilation failed!
Error: Symbol CheckKe4a is not defined in current scope  FILE:Ke4macro.C 
LINE:6
*** Interpreter error recovered ***
-----------------

If I execute interactively the commands:

.L libPhysics.so
.L libKe4Event.so
.include /afs/cern.ch/user/m/masettil/private/Ke4/treelib
.L CheckKe4.C+

the compilation gives no errors and then I can also execute the macro without 
getting any error.

Am I doing something wrong in the macro?

Thanks,
Lucia



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET