<TBranchElement::GetDataMemberOffset>: obsolete call

namespace trk{                                                                                                                             
class Header : public TObject{ ... };                                                                                                                             
class Event : public TObject{
 private:
  Header _head;
  Int_t  _nClusters;
  ...
};                                                                                                                             
}

namespace tof{                                                                       
class Header : public TObject{ ... };
class Event : public TObject{
 private:
  Header _head;
  Int_t  _nBars;
  ...
};
}

namespace glb{
class Event : public TObject{
private:
  trk::Event _trkev;
  tof::Event _tofev;
  ...
};                                                                                                                             
}

I can write a ROOT file with this structure.
But when I read this file I have this error:

Error in TBranchElement::GetDataMemberOffset: obsolete call with (trk::Event,_trkev._head)
Error in TBranchElement::GetDataMemberOffset: obsolete call with (trk::Event,._head)
Error in TBranchElement::GetDataMemberOffset: obsolete call with (trk::Event,._head)
Error in TBranchElement::GetDataMemberOffset: obsolete call with (tof::Event,_tofev._head)
Error in TBranchElement::GetDataMemberOffset: obsolete call with (tof::Event,._head)
Error in TBranchElement::GetDataMemberOffset: obsolete call with (tof::Event,._head)

Thank you for your help.
Alberto

Hi,

Could you send me a running example so that I can understand the problem and maybe fix it :slight_smile:

Cheers,
Philippe.

Did you received my e-mail?

First I compile the files attached with a linkdef.h like this:

[code]#ifdef CINT
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ nestedclass;
#pragma link C++ nestedtypedef;

#pragma link C++ namespace tof;
#pragma link C++ namespace trk;
#pragma link C++ namespace glb;

#pragma link C++ class tof::Header+;
#pragma link C++ class tof::Event+;
#pragma link C++ class trk::Header+;
#pragma link C++ class trk::Event+;
#pragma link C++ class glb::Event+;

#pragma link C++ class tof;
#pragma link C++ class trk;
#pragma link C++ class glb;
#endif [/code]

after in ROOT 4.03 I do:

.L micro.cxx TFile f("micro.root") TTree* mytree = (TTree*) f->Get("mytree") glb::Event* event = new glb::Event() mytree->SetBranchAddress("mybranch",&event)

then the problem occurs.
micro.h (1.72 KB)
micro.cxx (1.01 KB)
main.cxx (834 Bytes)

Hi,

The problem comes from the fact that you are trying to read data using the interpreted version of your classes.
Instead of.L micro.cxx you should load a library defining your classes.

And indeed, we should improve the situation so that it would work in this case anyway or at the very least issue a proper warning message.

Cheers,
Philippe.

PS. For example I used loader.C

#include "micro.h" #include "linkdef.h" #include "micro.cxx" and

Thank you very much,
I have tried to do a shared library with the C++ linker,
but doesn’t work. But in this way the problem is solved,
thank you for the help,
and for your precious time.

Best regards,
Alberto :smiley: