Hi experts
I want to add a directory in the include path and have already read the part of manual related to that. I still have some puzzle about that.
I have 2 dirs. One is include
, one is macros
. Under include
, I have one header, the content is
namespace ana{
const double PI = 3.14;
};
Under macros
, I have one macros called test.C
, the content is
void test(){
gROOT->ProcessLine(".include ../include");
gROOT->ProcessLine("#include \"consts.h\"");
gROOT->ProcessLine("cout << ana::PI << endl;");
}
It works. But if I write like this
gROOT->ProcessLine(".include ../include");
gROOT->ProcessLine("#include \"consts.h\"");
cout << ana::PI << endl;
or
#include "consts.h"
void test(){
gROOT->ProcessLine(".include ../include");
cout << ana::PI << endl;
}
It will not work.
And if I do in another way, in macros/test1.C
,
#include "consts.h"
void test1(){
cout << ana::PI << endl;
}
in macros/test2.C
,
void test2(){
gROOT->ProcessLine(".include ../include");
gROOT->ProcessLine("#include \"consts.h\"");
gROOT->ProcessLine(".x test1.C");
}
test2.C
would work.
Is there any way to avoid using two macros to finish one task?
Thanks
ROOT Version: 6.18
Platform: MacOSX
Compiler: Not Provided