RE: [ROOT] Compiling a class in a macro

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri May 09 2003 - 18:34:31 MEST


Hi,
Instead of:

gSystem->SetIncludePath("/afs/cern.ch/user/m/masettil/private/Ke4/treelib/")
;
use
  TString path = gSystem->GetIncludePath();
  path.Append(" -I/afs/cern.ch/user/m/masettil/private/Ke4/treelib ");
  gSystem->SetIncludePath(path);

TSystem::SetIncludePath is not cumulative.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Lucia Masetti
Sent: Tuesday, May 06, 2003 8:42 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Compiling a class in a macro


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.c
xx
/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.c
xx: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.c
xx: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.c
xx: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