# How can I use my owen header files like #include\<myFunction.h\>

**URL:** <https://root-forum.cern.ch/t/how-can-i-use-my-owen-header-files-like-include-myfunction-h/60205>\
**Category:** Newbie\
**Tags:** root\
**Created:** [July 15, 2024, 7:47am UTC](https://root-forum.cern.ch/t/how-can-i-use-my-owen-header-files-like-include-myfunction-h/60205 "2024-07-15T07:47:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xibeilius](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/xibeilius/32/37091_2.png) [@Xibeilius](https://root-forum.cern.ch/u/Xibeilius)\
**Post date:** [July 15, 2024, 7:47am UTC](https://root-forum.cern.ch/t/how-can-i-use-my-owen-header-files-like-include-myfunction-h/60205/1 "2024-07-15T07:47:40Z")

</div>

I have a header file myFunction.h, defined a function prototype wroten by myself. And I implemented this function in a cpp file myFunction.cpp. How can I use the function in my ROOT macro? Like:

> #include\<myFunction.h\>  
> void myMacro()  
> {  
> myFunction();  
> }

I’m new to ROOT and C++, sorry.

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [July 15, 2024, 9:33am UTC](https://root-forum.cern.ch/t/how-can-i-use-my-owen-header-files-like-include-myfunction-h/60205/2 "2024-07-15T09:33:46Z")

</div>

```auto
#include "myFunction.h"

```

or

```auto
#include "/full/path/to/myFunction.h"

```

> **[\#include directive (C/C++)](https://learn.microsoft.com/en-us/cpp/preprocessor/hash-include-directive-c-cpp?view=msvc-170)**
>
> Learn more about: #include directive (C/C++)

---

<div class="post-metadata">

**Author:** ![Xibeilius](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/xibeilius/32/37091_2.png) [@Xibeilius](https://root-forum.cern.ch/u/Xibeilius)\
**Post date:** [July 15, 2024, 9:49am UTC](https://root-forum.cern.ch/t/how-can-i-use-my-owen-header-files-like-include-myfunction-h/60205/3 "2024-07-15T09:49:54Z")

</div>

I see. It should be okay to use \<\> when the myFunction.h in the same path of myMacro.cpp. But even if I use “”, it still tells me that the function is not defined.  
I think this may be because the file myFunction.cpp is not read correctly. What should I do?

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [July 15, 2024, 10:38am UTC](https://root-forum.cern.ch/t/how-can-i-use-my-owen-header-files-like-include-myfunction-h/60205/4 "2024-07-15T10:38:01Z")

</div>

Start by searching online and reading about including stuff in C++ (probably not a ROOT issue). E.g. [Headers and Includes: Why and How - C++ Articles](https://cplusplus.com/articles/Gw6AC542)
