Base class has incomplete type if I running from rootscript

Dear All:
I’ve tried to make my own class with root.
met some problem
see the source code below

if I run from root prompt, it’s OK

cx[000]:> #include "corT1.hh"
cx[001]:>

but if I run from root script file

p1.root

#include "CorT1.hh"  // the header cannot write first??
void p1(){}
root p1.root

cause

Processing p1.cpp...
In file included from libtestIO dictionary payload:6:
/Users/xx/software/corsika/corsikainterface/rootbug/CorT2.hh:19:22: error: base class has incomplete type
class CorT2 : public CorT1 {
              ~~~~~~~^~~~~
libtestIO dictionary forward declarations' payload:5:117: note: forward declaration of 'CorT1'
class __attribute__((annotate("$clingAutoload$/Users/chenxu/software/corsika/corsikainterface/rootbug/CorT1.hh")))  CorT1;
                                                                                                                    ^
In file included from libtestIO dictionary payload:6:
/Users/xx/software/corsika/corsikainterface/rootbug/CorT2.hh:22:12: error: only virtual member functions can be marked 'override'
  ~CorT2() override = default;
           ^~~~~~~~
...

I seem that I’ve to load the library first, then #include the header.

Q.E: Can I add the #include header at the top of file?


_ROOT Version:6.35.01
_Platform:macos


source code:

maybe link:

Q.E: Can I add the #include "corT1.hh" at the top of file?
as the code completer needs the header

same issue as
https://github.com/root-project/root/issues/13034

Hi,

Thanks for the report. Sorry to read that ROOT did not work out of the box for you.
Are you saying that this is an incarnation of Bundling base class and derived class in same dictionary can lead to failure in recursive parsing. · Issue #13034 · root-project/root · GitHub ?
I think I do not understand well if you have just a header, or a library with a dictionary of the class (I assume the root file above should be a source file instead)

Best,
D

I mean.
I cannot run file

#include "CorT1.hh"  // the header cannot write first??
void p1(){}
root p1.cpp  # cause errors

but at root prompt, it’s OK

gSystem->Load("libtestIO.so");

then

[root]:> #include "CorT1.hh"

or

[root]:>gSystem->Declare("#include \"CorT1.hh\"")

I’m trying to find a way to solve this.
I’ve built the rootmap, but not worked.

I’ve update the source as a minimal e.g.
see q1/CMakeLists.txt at master · cxwx/q1 · GitHub

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