Root headers

Hello ROOT team,

I have got a question about ROOT header files. For example, if you look at THStack.h. THStack derives from TNamed, but there is no include of TNamed.h in the header.

So, my question is why. And why does ROOT compile anyway? (probably because they are included somewhere else) Is it to save compile time?

The reason for my question is my editor: I’m using KDevelop and quite like having syntax completion everywhere (like pressing tab in interactive ROOT sessions). But because e.g. TNamed is not known in THStack.h, syntax completion for all methods derived from TNamed does not work. THStack is just one example.

Also Rtypes.h is not included although types declared in that header are used in a lot of other headers. Wouldn’t it be cleaner to include these headers if types declared in them are used?

Thanks for clarification, Wolf

[quote=“Wolf”]Hello ROOT team,

I have got a question about ROOT header files. For example, if you look at THStack.h. THStack derives from TNamed, but there is no include of TNamed.h in the header.

So, my question is why. And why does ROOT compile anyway? (probably because they are included somewhere else) Is it to save compile time?
[/quote]

It is included (eventually). It includes a file that includes a file that includes a file (…) that includes TNamed.h.

Cheers,
Charles

Ah, thank you. You are right. I had trusted my editor too much.

So the include chain is THStack -> TH1 -> THAxis -> TNamed

So I guess KDevelop is not recursing deep enough through the headers. Probably there is an option to adjust that, I will have a look (and ask elsewhere if I don’t find the solution).

Thanks, Wolf

Edit: Turned out that there was probably something wrong in the KDevelop DUChain cache. After removing ~/.kdevduchain there was no problem any more, syntax completion started working :slight_smile: Very good!