# Cannot set include path for external headers in macro

**URL:** <https://root-forum.cern.ch/t/cannot-set-include-path-for-external-headers-in-macro/32015>\
**Category:** Newbie\
**Created:** [December 14, 2018, 1:58am UTC](https://root-forum.cern.ch/t/cannot-set-include-path-for-external-headers-in-macro/32015 "2018-12-14T01:58:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsharankova](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@rsharankova](https://root-forum.cern.ch/u/rsharankova)\
**Post date:** [December 14, 2018, 1:58am UTC](https://root-forum.cern.ch/t/cannot-set-include-path-for-external-headers-in-macro/32015/1 "2018-12-14T01:58:40Z")

</div>

Hello,

I am trying to load some external classes to use in a macro. If I add the include path interactively I can successfully include the header. However if I write the following macro test.C:

```auto
gInterpreter->AddIncludePath("path_to_header");
#include "myclass.h"
gSystem->Load("path_to_lib");

void test(){
std::cout << "test" << std::endl;
}

```

when I try to run it I get the following error:

```auto
 test.C:3:13: error: expected function body after function declarator
gInterpreter->AddIncludePath("./inc");  
 test.C:5:10: fatal error: 'myclass.h' file not found
#include "myclass.h"

```

Could you possibly tell me what I am doing wrong?  
I am using ROOT 6.14.06 on Ubuntu 16.04.2 .

Best regards,  
Ralitsa

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [December 14, 2018, 8:00am UTC](https://root-forum.cern.ch/t/cannot-set-include-path-for-external-headers-in-macro/32015/2 "2018-12-14T08:00:28Z")

</div>

Use:

```auto
R__ADD_LIBRARY_PATH(path)
R__LOAD_LIBRARY(library)
R__ADD_INCLUDE_PATH(path)

```

---

<div class="post-metadata">

**Author:** ![rsharankova](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@rsharankova](https://root-forum.cern.ch/u/rsharankova)\
**Post date:** [December 14, 2018, 6:16pm UTC](https://root-forum.cern.ch/t/cannot-set-include-path-for-external-headers-in-macro/32015/3 "2018-12-14T18:16:26Z")

</div>

Thank you for the prompt reply. I did not realize the way to load changed in ROOT6. Now it works fine.

Best regards,  
Ralitsa
