Incomplete type in rdict.pcm. Cannot interpret expression for RDataFrame

ROOT Version: v6.16
Platform: Linux (CC7)
Compiler: gcc 4.8.5

Dear everybody,

I’m not sure whether this issue is more related to RDataFrame or rather to rootcling. I prepared an example which defines a class “testclass” just holding an integer variable which can be accessed by a getter and setter “getVal()”, " setVal". This class is inherent from TObject to use ROOTs I/O features. Then there is the main.cpp which contains a function to write instances of this class into a rootfile and another function to read this file again into a dataframe. A filter is applied using the feature of interpreting the string (I guess at runtime, right?) as follows:

auto df = d.Filter(“b0.getVal() < 5”);

This example work pretty fine if everything is executed within the root framework a la:
root [0] .L testclass.cxx+
root [1] .L main.cpp
root [2] writeTree()
root [3] readTree()
5 entries passed all filters

However if I compile all files into a standalone app using the attached makefile I get the following error at runtime:

input_line_44:1:49: error: variable has incomplete type ‘testclass’
namespace __tdf_0{ auto tdf_f = {testclass b0;
G__testclass dictionary forward declarations’ payload:5:402: note: forward declaration of ‘testclass’
…__attribute__((annotate("$clingAutoload$testclass.hxx"))) testclass;
terminate called after throwing an instance of ‘std::runtime_error’
what(): Cannot interpret the following expression:
b0.getVal() < 5

Make sure it is valid C++.
Aborted (core dumped)

By coincidence I found that if I remove the *rdict.pcm, so that the header of testclass.hxx must be reparsed at runtime, it work. It seems like there are some information missing in the rdict.pcm which are required to interpret the filter string “b0.getVal() < 5”. May I do something wrong when generating the dictionary using rootcling?

I could reproduce the error on lxplus7 and on MacOS.

rdf_rdict.tar.gz (1.5 KB)

Many thanks in advance,

Hi Kai,

it looks like a problem in the way the dictionary is generated.
Can you share a minimal reproducer?


Hi D,

I’m not sure, what do you mean with reproducer? The small make file project which I attached above was thought as a minimal example to reproduce the error that I described. Is the generated main program running on your PC?

I don’t use anything special to create the dictionary (line 53 in makefile):

rootcling -f G__testclass.cxx testclass.hxx testclass.hxx testclassLinkDef.h


Hi Kai,

this is an issue with RDF. We have a preliminary solution about it and we’ll fix it for ROOT 6.16/02 and ROOT 6.18.
To unblock you, this is a possible workaround: make known the class testclass to the interpreter by adding to your “main” code:

gInterpreter->Declare("#include \"myclass.hxx\"")


1 Like

Hi Danilo,

that’s great, thanks a lot! I didn’t expect that gInterpreter is accessible even within standalone programs. Very interesting! With that fix, it works like a charm. I’m looking forward to the next release.


Hi Kai,

thanks for reporting the problem, your patience and reproducer.


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