How to use gInterpreter?

Hey,
i attached a small program structure containing a src, header ,rootlogon and a macro. It works totally fine if i use for instance gROOT->ProcessLine(…) in my rootlogon or interactively in a root session. This is actually an easy way to include his own classes.
Nevertheless im eager to know how i can run this program using gInterpreter->AddIncludePath(…). I didnt find anything helpful in the forum or in the users guide.
Secondly, what is the advantage using the command .L somefile.cc+ instead of .L somefile.cc . Why should i even compile it in the first place? (perhaps it is faster…)
Thanks for any help you can provide.
Kevinrootplayground.tar.gz (801 Bytes)

Hi Kevin,

See https://root.cern.ch/root/htmldoc/guides/users-guide/Cling.html#the-c-interpreter-cling for info on .L code.C+ (also known as ACLiC).

AddIncludePath() is used to tell the interpreter to also look at other directories when searching for included files. As your example always specifies the (relative) path to the headers you don’t need that.

Axel.

Hey Alex,
thanks for your response. So what should i do if i wanna use AddIncludePath() instead (theoretically)?
Kevin

Hi Kevin,

you can convert

#include "../include/foo.h"

to

#include "foo.h"

with

gInterpreter->AddIncludePath("../include/");

Axel.

1 Like