1.2.3. Standard compilation

For C++ enthusiasts, it is possible to use ROOT (and subsequently Uranie) as a set of libraries, and to compile an executable. In this case, you have to take care of linked libraries. In order to help the user, ROOT provides a macro that give many of the needed flag to perform the compilation, both to give the path to the headers and the path to the libraries.

g++ -o OutputName TheFileName.C  `root-config --cflags --libs`

For this example:

  • OutputName: the name of the resulting executable

  • TheFileName.C: the C++ file containing the code

  • root-config --cflags --libs: this command provides all the necessary flags to compile most of the macros using ROOT.

This is a logic we acknowledge and try to follow as well for Uranie: if one wants to compile an Uranie macro, one can use two flags.

  • URANIECPPFLAG: it defines all the include path needed and add on top the ones from ROOT;

  • URANIELDFLAG: it defines the linking option and path to library and add on top the ones from ROOT;

With this, an example of standalone compilation for a given macro UranieMacro.C will be:

g++ -o OutputExecutable UranieMacro.C  `echo ${URANIECPPFLAG} ${URANIELDFLAG}`