TH1D inheritance

Hello,

I am trying to extends TH1D and add some additional parameters related to my physics case.
Additionally, I am declaring new constructor as shown below


#ifndef exTH2D_H
#define exTH2D_H

#include <Riostream.h>

#include <TObject.h>
#include <TH1D.h>

namespace UMO {
        class exTH2D: public TH1D
        {
                private:

                public:
                        exTH2D() : TH1D() {};
                        exTH2D(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup) : TH1D(name, title, nbinsx, xlow, xup) {};
                        exTH2D(const char *name, const char *title, Int_t nbinsx, const Float_t  *xbins) : TH1D(name, title, nbinsx, xbins) {};
                        exTH2D(const char *name, const char *title, Int_t nbinsx, const Double_t *xbins) : TH1D(name, title, nbinsx, xbins) {};
                        explicit exTH2D(const TVectorD &v) : TH1D(v) {};
                        exTH2D(const exTH2D &ts) : TH1D(ts) {};
                        ~exTH2D() override {};

                        void Print(Option_t *option = "") const override;

                ClassDefOverride(UMO::exTH2D,1);
        };
}
#endif

I can use it in my compiled programs but when I try to load it in TBrowser I am getting the following issue:

#pragma clang diagnostic pop
  ==== SOURCE END ====
Error in <TClingCallFunc::Exec(address, interpVal)>: Called with no wrapper, not implemented!
Error in <TClingCallFunc::make_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
__attribute__((used)) __attribute__((annotate("__cling__ptrcheck(off)")))
extern "C" void __cf_171(void* obj, int nargs, void** args, void* ret)
{
   ((TGFileBrowser*)obj)->Update();
   return;
}
#pragma clang diagnostic pop
  ==== SOURCE END ====
Error in <TClingCallFunc::Exec(address, interpVal)>: Called with no wrapper, not implemented!
Error in <TClingCallFunc::make_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
__attribute__((used)) __attribute__((annotate("__cling__ptrcheck(off)")))
extern "C" void __cf_172(void* obj, int nargs, void** args, void* ret)
{
   ((TTimer*)obj)->TurnOn();
   return;
}
#pragma clang diagnostic pop
  ==== SOURCE END ====
Error in <TClingCallFunc::Exec(address, interpVal)>: Called with no wrapper, not implemented!
Error in <TClingCallFunc::make_wrapper>: Failed to compile
  ==== SOURCE BEGIN ====
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
__attribute__((used)) __attribute__((annotate("__cling__ptrcheck(off)")))
extern "C" void __cf_173(void* obj, int nargs, void** args, void* ret)
{
   ((TTimer*)obj)->TurnOff();
   return;
}
#pragma clang diagnostic pop
  ==== SOURCE END ====
Error in <TClingCallFunc::Exec(address, interpVal)>: Called with no wrapper, not implemented!
^C

Would you have any advice how I can fix it ? :slight_smile:
Many thanks

ROOT: v6.26

I tried to load the object from a saved root file as a TH1D and this is working.
So this is a loading issue in my custom object. :’-(


root [5] _file0->Get("test")
(TObject *) 0x562c173801d0
root [6] TH1D *h = _file0->Get("test");
ROOT_prompt_6:1:7: error: cannot initialize a variable of type 'TH1D *' with an rvalue of type 'TObject *'
TH1D *h = _file0->Get("test");
      ^   ~~~~~~~~~~~~~~~~~~~~~
root [7] TH1D *h = (TH1D*)_file0->Get("test");
root [8] h->Draw()
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [9] UMO::exTH1D *h2 = (UMO::exTH1D*)_file0->Get("test");
/home/marcomeyer/Software/root/6.26.00/etc//cling/std.modulemap:368:10: error: module 'std.codecvt' is incompatible with feature 'header_existence'
  module "codecvt" {
         ^
/usr/include/c++/9/bits/fs_path.h:40:10: note: submodule of top-level module 'std' implicitly imported here
#include <codecvt>

Do you load the dictionary for UMO::exTH2D before opening the file? Does loading its library before opening the ROOT file help?

Hi @Axel

I do load the library in interactive using gSystem->load("libUMO.so").
Additionally I have compiled programs with graphics that present the same issue.

However, after doing some additional tests I have found that actually the same message appear for any of my class inheriting from TObject. (not only TH2D)
Same error message:

/home/marcomeyer/Software/root/6.26.00/etc//cling/std.modulemap:368:10: error: module 'std.codecvt' is incompatible with feature 'header_existence'
  module "codecvt" {
         ^
/usr/include/c++/9/bits/fs_path.h:40:10: note: submodule of top-level module 'std' implicitly imported here

#include <codecvt>

I managed to get the stack during one crash. It is attached below, but unfortunately I cannot understand it :frowning:
backtrace.txt (22.4 KB)

Perhaps I am missing something in my LinkDef ?

#ifdef __CINT__

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

#pragma link C++ namespace UMO+;

#pragma link C++ class UMO::exTH2D+;

#endif

Should I perhaps remove the line #pragma link off all classes; :face_with_monocle:

Can you verify that after loading your library, UMO::exTH2D::Class()->GetName() returns what you’d expect?

Hi Axel,

I cannot figure out, but removing build directory and changing ROOT from v6.26 to v6.26/04 seems to fix the issue.

Best regards,
Marco

1 Like

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