Forward declaration of TList

Hi,

I wanted to update my code from v5.14 to v5.20…

During compilation I got the following error message:

/afs/desy.de/group/zeus.zsmsm/ZEUSSysSoft/Released/Support/root/i586-sl3-linux/5.20.00/include/TBuffer.h: In
function TBuffer& operator>>(TBuffer&, Tmpl*&) [with Tmpl = TList]': ../dict/i586-sl3-linux/ZBMuonDict.cxx:115: instantiated from here /afs/desy.de/group/zeus.zsmsm/ZEUSSysSoft/Released/Support/root/i586-sl3-linux/5.20.00/include/TBuffer.h:347: invalid use of undefined typestruct TList’
/afs/desy.de/group/zeus.zsmsm/ZEUSSysSoft/Released/Support/root/i586-sl3-linux/5.20.00/include/TObject.h:48: forward
declaration of struct TList' /afs/desy.de/group/zeus.zsmsm/ZEUSSysSoft/Released/Support/root/i586-sl3-linux/5.20.00/include/TBuffer.h: In functionTBuffer& operator<<(TBuffer&, const Tmpl*) [with Tmpl = TList]’:
…/dict/i586-sl3-linux/ZBMuonDict.cxx:122: instantiated from here
/afs/desy.de/group/zeus.zsmsm/ZEUSSysSoft/Released/Support/root/i586-sl3-linux/5.20.00/include/TBuffer.h:354: invalid
use of undefined type struct TList' /afs/desy.de/group/zeus.zsmsm/ZEUSSysSoft/Released/Support/root/i586-sl3-linux/5.20.00/include/TObject.h:48: forward declaration ofstruct TList’
make[1]: *** […/obj/i586-sl3-linux/ZBMuonDict.o] Error 1
make[1]: Leaving directory `/data/zenith232a/juengst/216a/v2.03/ZevLib/cmd’
make: *** [comps] Error 1

I know that the TBuffer structure changed in v5.16 but I do explicitly include TBuffer.h in my classes. This is only indirect included as it is in TObject.h.

In the dict file there is a streamer function which writes stuff into a TList:

//______________________________________________________________________________
void ZBMuon::Streamer(TBuffer &R__b)
{
// Stream an object of class ZBMuon.

UInt_t R__s, R__c;
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
TTUBE::Streamer(R__b);
R__b >> fStatusVisibilityBMuonGlobal;
R__b >> fZRShapes;
R__b >> fXYShapes;
R__b.CheckByteCount(R__s, R__c, ZBMuon::IsA());
} else {
R__c = R__b.WriteVersion(ZBMuon::IsA(), kTRUE);
TTUBE::Streamer(R__b);
R__b << fStatusVisibilityBMuonGlobal;
R__b << fZRShapes;
R__b << fXYShapes;
R__b.SetByteCount(R__c, kTRUE);
}
}

Do you have any idea what I have to change?

Cheers Markus

Did you #include “TList.h” ?

Rene

Yes,

I tried it with and without the include

in the cxx file …
#ifndef ROOT_TList
#include <TList.h>
#endif

and in the h file…
class TList;

with root 5.14 it was also running without any problem.

Markus

Hi,

You have 2 solutions, either [ul]* include TList.h in your header file.[/ul]or[ul]

  • Use the new I/O scheme by using the line#pragma link C++ class ZBMuon +;in your LinkDef.h file. Please note the trailing + that request the new I/O scheme.[/ul]
    Cheers,
    Philippe

Hi,

thanks a lot, seems to work…

Markus