<TKey::ReadObj>: Incorrect detection of the inheritanc

When my very simple class is attempted to be read, I get the above message:

Fatal in TKey::ReadObj: Incorrect detection of the inheritance from TObject for class SctArchiving::RootInteger

Can you help?

The class appears in the TClassList
class version bits initialized

SctArchiving::RootInteger 1 0 Yes

main looks like:

#include “…/src/primitives/RootInteger.cpp”
#include “TFile.h”
#include “TClassTable.h”
#include

using SctArchiving::RootInteger;

int main(){
{
TFile f (“blah.root”,“UPDATE”);
SctArchiving::RootInteger i(3);
i.Write(“myob”);
f.Close();
}

gClassTable->Print();

{
TFile g (“blah.root”,“READ”);
gDirectory->pwd();
gDirectory->ls();
RootInteger* i = (RootInteger*) g.FindObjectAny(“myob”);
std::cout << “PTR=” << i << std::endl;
std::cout << “VAL=” << *i << std::endl;
}
}

RootInteger looks like:
#ifndef SCTARCHIVING_ROOTINTEGER_H
#define SCTARCHIVING_ROOTINTEGER_H
#include “TObject.h”

namespace SctArchiving{
class RootInteger : public TObject{
public:
RootInteger() : value(0) {;}
RootInteger(int val) : value(val) {;}
void operator= (const RootInteger& rhs) {value=rhs.value;}
virtual char* GetClassName(){return “SctArchiving::RootInteger”;}
operator int(){ return value;}
virtual ~RootInteger();
private:
int value;
ClassDef(RootInteger,1);
};
}
#endif

RootInteger.cpp looks like:

#include "RootInteger.h"
SctArchiving::RootInteger::~RootInteger() {}
ClassImp(SctArchiving::RootInteger)

The LinkDef file looks like:

#ifdef CINT
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ namespace SctArchiving;
#pragma link C++ class SctArchiving::RootInteger;
#endif

Hi,

I am unable to reproduce this problem.
Which version of ROOT are you using?
What are you really running (your main is slighty incorrect).

Cheers,
Philippe.

Here is an attachment with the tarred gzipped files I was using.
gcc 3.2.3 and root 3.05/07
ajb57_root.tar.gz (1.01 KB)

Hi,

Note that the problem was first diagnosed during the writing pahse:[quote]Error in TClass::BuildRealData: can not find any ShowMembers function for SctArchiving::RootInteger![/quote]
The problem was in your linkdef file where you need to add a request to link nested class. Use the following linkdef file:#ifdef __CINT__ #pragma link C++ nestedclasses; #pragma link C++ namespace SctArchiving; #pragma link C++ class SctArchiving::RootInteger+; #endif

Cheers,
Philippe.