RE: [ROOT] Class not in dictionary (strange behaviour of TChain?)

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Nov 05 2001 - 19:36:24 MET


Hi Thomas,

The problem is a linker issue.

In your case, eventhough your specified, "-lmmc" on the linking line
of mars, nothing from the library libmmc.a is linked into mars.
When you add the spurious line 'MMcTrig trig;', the linker now 
know/thinks that you need the class MMcTrig which is inside libmmc.a and
thus is links the library. 

In unix/C++, when a nothing is (seems) needed from a library, that library
is totally completely ignored !!!  Thus the dictionary (and the rest of
the code) is not available.  [Note that when you open a file containing object
of a specific class, the file induces the creations of 'special' TClass object
for the missing class.  Later request for the TClass object in question 
will return ,without any warning, the existing 'special' TClass object]

In order to work around this issue, you should add to the link line 
the list of dictionary files that you know you need.  i.e.

g++ -o mars mmc/McDict.o mbase/BaseDict.o .... -l mmc -lmbase

Cheers,
Philippe.

Ps. A 'special' TClass object, is a TClass object that ONLY described the
persistent data member of a class.  This is what is needed to be able to
read a file without the original libraries.

-----Original Message-----
From: Thomas Bretz [mailto:tbretz@uni-sw.gwdg.de]
Sent: Monday, November 05, 2001 7:46 AM
To: pcanal@fnal.gov
Subject: Re: [ROOT] Class not in dictionary (strange behaviour of
TChain?)


Hi,

here it is. Unpack it (ba careful, the project is not unpacked into a
subdir). Call 'make' (this should work on Linux and Alpha. I don't now
if the error occurs also on alpha). Start 'mars' and click on 'Mone
carlo'. Choose the file 'camera.root' by a double click and select one
of the Buttons to start the eventloop. You'll find the following messge
on the screen:
-------
Warning in <TClass::TClass>: no dictionary for class MMcTrigHeader is
available
Warning in <TClass::TClass>: no dictionary for class MMcFadcHeader is
available
Warning in <TClass::TClass>: no dictionary for class MMcEvt is available
Warning in <TClass::TClass>: no dictionary for class MMcTrig is
available
--------
(eg. Collection area gives a flat line now)

Now go to mmain/MMonteCarlo.cc and search for /*HERE*/ three times.
Uncomment the three lines with the (completely nonsens and unused)
definition 'MMcTrig trig' No do 'make again' and do the same than above.
The error is gone and the data seems to be OK (collection are gives you
what we expect to see)

Regards,
Thomas.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:06 MET