Header file not found by ROOT


I am using ROOT version 5.35 in MAC OSX 10.9.4, in a macbook air. I attached a very short and simple piece of code. I have made the source include and run directories, if you go to the run directory and start a root session, the .rootrc should call the rootlogon.C in source, which should compile the class plotter_results, source file in source, and header file in include.

plotter_results inherits from TNamed and you can see that when I try to compile it it does not find the header file. However if either I don’t make it inherit from TNamed (so ClassDef goes away) or I don’t put the header file in include but in source the class compiles.

I added the include path with:


It also does not work if I use the complete path. Could you please take a look at the very short and simple example?

Example.zip (1.9 KB)

Adding Your Own Classes to ROOT
plotter_results.h (234 Bytes)
rootlogon.C (211 Bytes)


Thank you very much. For someone else out there who gets the same problem i had to replace the line:




In the rootlogon.C file, apart from the changes implied by the link. For some mysterious reason the first one works when I don’t use my own class derived from some root class (TNamed in my case), but I have to use the second one otherwise.

The first one (i.e. “gInterpreter->AddIncludePath(…);”) did NOT work in your case (even if you dropped TNamed and ClassDef). You were able to compile and load it but the dictionary for your class was “empty”. Try:
root [0] .class plotter_results

Thanks Mr Coyote :smiley: .


Just for you all out there to know, some versions of ROOT seem to be ok with writting

i.e. use the relative location of the include directory. However other versions dont like this (nothing about this in root.cern.ch/root/html/TInterpr … ncludePath I had to find it out myself) for some reason and you have to put the entire path:

Which is done with:

    TString wd = TString( gSystem->pwd() ) + TString("/../include");
    gInterpreter->AddIncludePath( wd.Data() );