Problem compiling macro with header containing vectors

Greetings,

I have a long program that calls a header file that uses vectors of vectors.
I try compiling the program and I get errors. I have searched the forums and found similar posts with
[url]Vectors in 5.28.00
and
[url]MakeSelector TTree gives: Invalid type vector<vector<int>

None of these fixes seem to be applicable to me.

I have attached a small file that mimics the problem and that compiles with gcc

g++ -o example example.cpp
but will not compile with root

root -l example-root.cpp

The difference between the attached files example.cpp and example-root.cpp is that example-root.cpp has ROOT headers

Using ROOT v5.30
Thanks
Michael
pcor.txt (720 Bytes)
g12_pcor.hpp (3.6 KB)
g12_ecor.hpp (115 KB)
example.cpp (1.99 KB)
example-root.cpp (2.32 KB)

Try (use the attached modified “example-root.cpp”): `root-config --cxx --cflags` -W -Wall -o example-root example-root.cpp `root-config --glibs` ./example-root and/or: root -q -l example-root.cpp++
example-root.cpp (2.67 KB)

Thank you for the fix, however that fix worked for the small example I gave. When I apply this method to my program I get the same errors as I did with the example program before.

The attached macro is the macro I am trying to use.

The errors I get are

Error: Symbol #include is not defined in current scope :0: Error: Symbol exception is not defined in current scope :0: Syntax Error: #include <exception> :0: Error: Symbol G__exception is not defined in current scope :0: Error: type G__exception not defined FILE: LINE:0 (int)0 *** Interpreter error recovered ***

Thank You
RUN_Beam_and_Momentum.C (115 KB)

I think I have found the cause,

It was located in the header file, lines which included

string infile = parms_dir+"/pcor/g12/pcor.txt";

and

throw std::runtime_error(string("error opening pcor file: ")+infile);

Everything seems to be running. I will report back if a problem arises again.
Thanks