Re: [ROOT] Inheriting from base class made from MakeSelector

From: Swagato Banerjee (swaban@SLAC.stanford.edu)
Date: Fri Jul 18 2003 - 23:21:09 MEST


Hi Thomas:
If you crate {MyBase.C, MyBase.h} using MakeSelector, you will notice
that MyBase.h has lines like
#ifdef MyBase_cxx
#endif // #ifdef MyBase_cxx

and MyBase.C has line
#define MyBase_cxx

I could get by this problem you mention by inheriting MyDerived from
MyBase and including the class definition in following order in analysis
code:

#include "MyDerived.hh"
#include "MyDerived.cc"
#include "MyBase.h"
#include "MyBase.C"

Does this hack work for you?
-regards,
Swagato

On Fri, 18 Jul 2003, Thomas Schoerner wrote:

> Hi,
>
> I created a base class AnaBase using MakeSelector and am try to inherit
> from it into a class AnaJet. I include the .h and .C files in the
> attachment. The error message is below. Does anybody know what I am doing
> wrong? I tried both commenting and not commenting the general methods that
> are not implemented in AnaJet
> (Init,Notify,SetOption,SetObject,SetInputList,GetOutputList).
>
> Cheers, and thanks,
>
> Thomas
>
> nfo in <TUnixSystem::ACLiC>: creating shared library
> /data/zenith209b/schorner/root/./AnaJet_C.so
> In file included from /data/zenith209b/schorner/root/filePHFvWs.h:29,
>                  from /data/zenith209b/schorner/root/./filePHFvWs.cxx:13:
> /data/zenith209b/schorner/root/AnaJet.C: In method `Bool_t
> AnaJet::ProcessCut(int)':
> /data/zenith209b/schorner/root/AnaJet.C:227: warning: unused variable
> `Int_t iCounter'
> /data/zenith209b/schorner/root/AnaJet.C:226: warning: unused variable
> `class TLorentzVector * iterator_Object'
> dlopen error: /data/zenith209b/schorner/root/./AnaJet_C.so: undefined
> symbol: Notify__6AnaJet
> Load Error: Failed to load Dynamic link library
> /data/zenith209b/schorner/root/./AnaJet_C.so
> In file included from /data/zenith209b/schorner/root/filePHFvWs.h:29,
>                  from /data/zenith209b/schorner/root/./filePHFvWs.cxx:13:
> /data/zenith209b/schorner/root/AnaJet.C: In method `Bool_t
> AnaJet::ProcessCut(int)':
> /data/zenith209b/schorner/root/AnaJet.C:227: warning: unused variable
> `Int_t iCounter'
> /data/zenith209b/schorner/root/AnaJet.C:226: warning: unused variable
> `class TLorentzVector * iterator_Object'
> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x18): undefined reference to `main'
> /data/zenith209b/schorner/root/./filePHFvWs.o: In function
> `AnaJet::ShowMembers(TMemberInspector &, char *)':
> /data/zenith209b/schorner/root/./filePHFvWs.o(.text+0xc373): undefined
> reference to `AnaBase::ShowMembers(TMemberInspector &, char *)'
> /data/zenith209b/schorner/root/./filePHFvWs.o(.gnu.linkonce.d.__vt_6AnaJet+0x94):
> undefined reference to `AnaJet::Notify(void)'
> /data/zenith209b/schorner/root/./filePHFvWs.o(.gnu.linkonce.d.__vt_6AnaJet+0xe4):
> undefined reference to `AnaJet::Init(TTree *)'
> /data/zenith209b/schorner/root/./filePHFvWs.o: In function `AnaJet
> type_info function':
> /data/zenith209b/schorner/root/./filePHFvWs.o(.gnu.linkonce.t.__tf6AnaJet+0x22):
> undefined reference to `AnaBase type_info function'
> /data/zenith209b/schorner/root/./filePHFvWs.o(.gnu.linkonce.t.__tf6AnaJet+0x2d):
> undefined reference to `AnaBase type_info node'
> /data/zenith209b/schorner/root/./filePHFvWs.o: In function
> `AnaJet::AnaJet(AnaJet const &)':
> /data/zenith209b/schorner/root/./filePHFvWs.o(.AnaJet::gnu.linkonce.t.(AnaJet
> const &)+0x292): undefined reference to `AnaBase::~AnaBase(void)'
> /data/zenith209b/schorner/root/./filePHFvWs.o: In function
> `AnaJet::AnaJet(TTree *)':
> /data/zenith209b/schorner/root/./filePHFvWs.o(.AnaJet::gnu.linkonce.t.(TTree
> *)+0x24): undefined reference to `AnaBase::AnaBase(TTree *)'
> /data/zenith209b/schorner/root/./filePHFvWs.o(.AnaJet::gnu.linkonce.t.(TTree
> *)+0x58): undefined reference to `AnaBase::~AnaBase(void)'
> /data/zenith209b/schorner/root/./filePHFvWs.o: In function
> `AnaJet::~AnaJet(void)':
> /data/zenith209b/schorner/root/./filePHFvWs.o(.gnu.linkonce.t._._6AnaJet+0x30):
> undefined reference to `AnaBase::~AnaBase(void)'
> /data/zenith209b/schorner/root/./filePHFvWs.o: In function
> `AnaBase::AnaBase(AnaBase const &)':
> /data/zenith209b/schorner/root/./filePHFvWs.o(.AnaBase::gnu.linkonce.t.(AnaBase
> const &)+0x2d): undefined reference to `AnaBase virtual table'
> collect2: ld returned 1 exit status
> *** Interpreter error recovered ***
> Error in <TSelector::GetSelector>: file AnaJet.C+ does not have a valid
> class deriving from TSelector
>
>
>



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