Template class in dictionary


I’ve got a class. It is added in a dictionary. This class is working fine for some time.
Now I thought: hey, you could do such a class with different precissions (analogous to TH1C, TH1I, TH1F, etc). But I didn’t want do do it more than once, so I copied the class definition and added a “T” to the class name. Changing the Constructor names, the parameter and return types (if necessary) and of course the class name in the ClassDef-macro. Same with the class implementation.
Then I copied the corresponding line in the LinkDef.h-file, adding the “T”.
So far that worked (ok, just emacs involved).
I compiled the new code using gcc-4. Worked.
Then I wanted to generate the dictionary:

Error: link requested for unknown class myClassT myLinkDef.h:22:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing myDict.cpp myDict.h !!!
Error: /usr/local/root-5.14.00e/bin/rootcint: error loading headers...

Any suggestions?


Hi Katharina,

you need to put specific template instantiations into myLinkDef.h, i.e.

#pragma link C++ class myClassT<float>; If that doesn’t help then please provide all the files necessary to reproduce the error you see plus the command line you run.

Cheers, Axel.