[ROOT] problems inheriting a class from TObject

From: Chris Hayward (cchaywar@umich.edu)
Date: Mon Jul 21 2003 - 20:25:54 MEST


Hello,
I am using ROOT 3.05/06 with gcc 2.96 on lxplus. I have defined a class
Chamber that inherits from TObject so that I can use ROOT I/O. I have
created a dictionary for the class using rootcint. When I type:

#include "Chamber.cxx"

in interactive mode of ROOT, I get the following errors:

Warning: Re-initialization ignored const kMaxUShort
FILE:/afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/Rtypes.h
LINE:97
Warning: Re-initialization ignored const kMaxShort
FILE:/afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/Rtypes.h
LINE:98
Warning: Re-initialization ignored const kMaxUInt
FILE:/afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/Rtypes.h
LINE:99
Warning: Re-initialization ignored const kMaxInt
FILE:/afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/Rtypes.h
LINE:100
Warning: Re-initialization ignored const kBitsPerByte
FILE:/afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/Rtypes.h
LINE:103
Warning: Re-initialization ignored const kNPOS
FILE:/afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/Rtypes.h
LINE:104
Limitation: Reference member not supported. Please use pointer
FILE:/afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/TGenericClassInfo.h
LINE:28
*** Interpreter error recovered ***

However, when I type in ROOT:

.L Chamber.cxx+
#include "Chamber.cxx"

I do not get any errors, and the class works fine. Why is this the case?
It would be nice to just work around it, but I fear that this will affect
compiled code.

Below are my (shortened) header, implementation, and link files for the
class Chamber. Thank you in advance for your help.

Chris Hayward


Chamber.h:

#ifndef CHAMBER_INCLUDED    //check if the header has already been loaded
#define CHAMBER_INCLUDED    //if not, set CHAMBER_INCLUDED and proceed

#include <iostream.h>
#include
</afs/cern.ch/sw/root/v3.05.06/rh73_gcc296/root/include/TObject.h>
//#include "TObject.h"    //TObject is necessary to inherit ROOT I/O
#include <string.h>

class TDirectory;       //needed by ROOT

class Chamber:public TObject {   //Chamber inherits from TObject

//class Chamber {

  public:

    Chamber() {};  //default constructor
    ~Chamber() {};

//variables and member functions defined here


  ClassDef (Chamber, 4);   //a class to store data about MDT chambers
};

#endif //CHAMBER_INCLUDED



Chamber.cxx:

#include "Chamber.h"
ClassImp (Chamber);


Chamber_LinkDef.h:

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class Chamber+;

#endif   //__CINT__



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