ROOT Version: 6.14 Platform: MacOSX Compiler: Not Provided
Hi,
I am trying to write a root macro which uses member functions from custom classes and namespaces, All these classes and namespaces are declared in different header files and their definitions are provided in corresponding .cpp files. The reason for doing this is to avoid writing all those classes, functions ad namespaces from scratch in every root macro which needs those functions (there will be more than 1 root file which will be using them).
Now when I try to run the root macro from root interpreter, those functions are not outputting the correct values. My guess is that they are not linked in the root macro.
I have tried creating a shared library of all those files and LinkDef.h file to create a dictionary but it is not working.
My question is how to link those files containing classes and namespaces in the root macro?
how did you create the dictionary, e.g. with what command? Did you for example create rootmap files (rootcling -h or genreflex -h will clarify further)?
Thanks @Danilo for your reply.
Like you suggested, this is what I did:
(pars.h is the class declaration file which has all the input parameters, decay_dist.h file is the declaration file of my namespace which has all the functions that I need, my analysis.C file uses both these files as well as their implementation *.cpp files. decay_dist.h is also dependent on pars.h.)
thanks for trying out.
You are missing the selection xml file in the invocation of genreflex. You can add it with the option -s myselection.xml. For the syntax of such file, you can see an example with genreflex --help.
Just to make sure that I understood it. You are saying I need to include -s myselection.xml file but in the example with genreflex --help, it is saying the usage is -s filename. So should I use my class declaration file or linkdef.h? Also, what type of file is myselection.xml?
as you say, the syntax is -s filename where filename is whatever name, for example myselection.xml. For the explanaitions about selection xml files, you can have a look to genreflex --help.
Error: rootcling: cannot open linkdef file pars.xml
I copied the template of the XML file from the genreflex --help and put it in a file pars.xml
and ran the above command again. I got this
Error: Malformed tag [<selection> (tag doesn't begin with <)!
Error: At line 2. Bad tag: [<selection>
Error: Parsing XML file pars.xml
I don’t know what’s going on and having a feeling that using shared libraries across the macros won’t work. I’ll just go back to defining classes and namespaces in each of my macros separately.