Re: [ROOT] Adding Event class for writing TTree with Geant4

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Apr 15 2002 - 11:22:08 MEST


Hi Christian,

 it looks like you forgot the ClassImp macro in the source and that you
forgot to run rootcint on this class.

Cheers, Fons.



On Mon, 2002-04-15 at 10:47, Christian.Doerr@mpi-hd.mpg.de wrote:
> Hello everybody!
> 
> I think I have a makefile/linking problem with using ROOT classes as part
> of a Geant4 simulation.
> 
> I'm using a "Recorder class" to collect informations from the simulation
> in order to write histograms and save the information in a ROOT Tree. For
> transfer the information to the Recorder class and also for filling the
> tree, I use my own Event class, named BBRootEvent, derived from TObject
> very similar to the Event class from the tutorials. In order to tell
> Geant4 that I'm using ROOT I added
> 
> CPPFLAGS += `root-config --cflags`
> LDFLAGS += `root-config --nonew --libs`
> 
> to my Geant4 makefile. Compiling the whole program works fine, but when
> trying to link the object files, I get the following message:
> 
> 
> Creating/replacing object files in
> /home/cdoerr/geant4/tmp/Linux-g++/betabeta/libbetabeta.a
> Using global libraries.
> Linking betabeta ...
> /home/cdoerr/geant4/tmp/Linux-g++/betabeta/libbetabeta.a(BBRootEvent.o):
> In function `basic_string<char, string_char_traits<char>,
> __default_alloc_template<true, 0> > type_info function':
> /home/cdoerr/geant4/betabeta/include/BBRootEvent.hh(.text+0x1f): undefined
> reference to `BBRootEvent::Class_Name(void)'
> /home/cdoerr/geant4/tmp/Linux-g++/betabeta/libbetabeta.a(BBRootEvent.o):
> In function `BBRootEvent::BBRootEvent(void)':
> /home/cdoerr/geant4/betabeta/src/BBRootEvent.cc:18: undefined reference to
> `BBRootEvent::ShowMembers(TMemberInspector &, char *)'
> /home/cdoerr/geant4/betabeta/src/BBRootEvent.cc:18: undefined reference to
> `BBRootEvent::Streamer(TBuffer &)'
> /home/cdoerr/geant4/tmp/Linux-g++/betabeta/libbetabeta.a(BBRootEvent.o):
> In function `basic_string<char, string_char_traits<char>,
> __default_alloc_template<true, 0> > type_info function':
> /home/cdoerr/geant4/betabeta/include/BBRootEvent.hh(.BBRootEvent::gnu.linkonce.t.StreamerNVirtual(TBuffer
> &)+0x12): undefined reference to `BBRootEvent::Streamer(TBuffer &)'
> collect2: ld returned 1 exit status
> make: *** [/home/cdoerr/bin/Linux-g++/betabeta] Error 1
> 
> 
> 
> Everything (except for writing the TTree) works fine if I omit the line
> 
> ClassDef(BBRootEvent,1) //BBRootClass
> 
> 
> I don't know anything about linking and very little about makefiles, so
> I'd be really happy for any kind of advice to solve this problem....
> Thanks a lot!!
> 
> Cheers, Christian
> 
> -----------------------------------------------------------
> Christian Doerr
> Max-Planck-Institut fuer Kernphysik, Heidelberg
> Bothe-Labor, room 232                phone: +49-6221-516-259
> email: C.Doerr@mpi-hd.mpg.de         www.christiandoerr.de
> -----------------------------------------------------------
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:50 MET