No dictionary for class

Dear ROOT’ers
I have strange problem. I have two files. Both contains one TObjectString with classname.
I would like to check if my class inherit from other class by this:

TClass *class_temp = new TClass(name);
class_temp->InheritsFrom("SomeBaseClass");

I use for this application (that is NOT linked with library with SomeBaseClass or class_temp). I could understand if such code crash (no dictionary because lack of linking). But something strange happen:

  • when I open let say file A - code works
  • when I open file “B”- I get this warning and code crash at line 2
    Why this works for one file but not for another? Is it safe to use this method if my application is not linked with classes that I would like to check (but those libraries are loaded automatically in ROOT)?
TClass *class_temp = new TClass(name);

You meant to write

TClass *class_temp = TClass::GetClass(name);

Thank you :slight_smile: Now it works, but I still don’t know why this crushed for one but not for second file.

There can only be one TClass per class/name, the message indicates that one was created during the file load and thus interfers with the one you created by hand (calling the ‘new TClass’ is only for ‘advanced’ use case and not for normal operation).

Cheers,
Philippe.

1 Like

Thank you for explanation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.