# Problem compiling macro with header containing vectors

**URL:** <https://root-forum.cern.ch/t/problem-compiling-macro-with-header-containing-vectors/14259>\
**Category:** ROOT\
**Created:** [May 9, 2012, 4:03am UTC](https://root-forum.cern.ch/t/problem-compiling-macro-with-header-containing-vectors/14259 "2012-05-09T04:03:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunks112](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/73ab20/32.png) [@kunks112](https://root-forum.cern.ch/u/kunks112)\
**Post date:** [May 9, 2012, 4:03am UTC](https://root-forum.cern.ch/t/problem-compiling-macro-with-header-containing-vectors/14259/1 "2012-05-09T04:03:40Z")

</div>

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](https://root-forum.cern.ch/t/vectors-in-5-28-00/11846/6)  
and  
[url][MakeSelector TTree gives: Invalid type vector\<vector\<int\>](https://root-forum.cern.ch/t/makeselector-ttree-gives-invalid-type-vector-vector-int/12780/1)

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

```auto
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](https://root-forum.cern.ch/uploads/default/original/2X/8/8fa8c9aa4c6107b6cd321cbf604be09324986fb1.txt) (720 Bytes)  
[g12\_pcor.hpp](https://root-forum.cern.ch/uploads/default/original/2X/6/69081282a2886c296410eee384ec38d102461ab6.hpp) (3.6 KB)  
[g12\_ecor.hpp](https://root-forum.cern.ch/uploads/default/original/2X/f/f262f0b8948abffc4592e42bcd709e5cc72af1f7.hpp) (115 KB)  
[example.cpp](https://root-forum.cern.ch/uploads/default/original/2X/b/be98b91255979df84521ef2284a68d12778cb4fa.cpp) (1.99 KB)  
[example-root.cpp](https://root-forum.cern.ch/uploads/default/original/2X/4/40f8fc6b05b1e5d1dfb5ed9c387096c470572e81.cpp) (2.32 KB)

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [May 9, 2012, 7:41am UTC](https://root-forum.cern.ch/t/problem-compiling-macro-with-header-containing-vectors/14259/2 "2012-05-09T07:41:26Z")

</div>

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](https://root-forum.cern.ch/uploads/default/original/2X/8/82898304ef6254ccdfad090d399c357f81684aa6.cpp) (2.67 KB)

---

<div class="post-metadata">

**Author:** ![kunks112](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/73ab20/32.png) [@kunks112](https://root-forum.cern.ch/u/kunks112)\
**Post date:** [May 9, 2012, 2:06pm UTC](https://root-forum.cern.ch/t/problem-compiling-macro-with-header-containing-vectors/14259/3 "2012-05-09T14:06:40Z")

</div>

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](https://root-forum.cern.ch/uploads/default/original/2X/1/1b9a92dfa60ecf6a038a186cc6c31066af7635da.C) (115 KB)

---

<div class="post-metadata">

**Author:** ![kunks112](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/73ab20/32.png) [@kunks112](https://root-forum.cern.ch/u/kunks112)\
**Post date:** [May 9, 2012, 3:57pm UTC](https://root-forum.cern.ch/t/problem-compiling-macro-with-header-containing-vectors/14259/4 "2012-05-09T15:57:00Z")

</div>

I think I have found the cause,

It was located in the header file, lines which included

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

```

and

```auto
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
