# Pythia8 compliation error, Pythia8/Pythia.h not found

**URL:** <https://root-forum.cern.ch/t/pythia8-compliation-error-pythia8-pythia-h-not-found/50549>\
**Category:** Newbie\
**Created:** [June 26, 2022, 6:27am UTC](https://root-forum.cern.ch/t/pythia8-compliation-error-pythia8-pythia-h-not-found/50549 "2022-06-26T06:27:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shrey\_Upadhyay](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shrey_upadhyay/32/29457_2.png) [@Shrey\_Upadhyay](https://root-forum.cern.ch/u/Shrey_Upadhyay)\
**Post date:** [June 26, 2022, 6:27am UTC](https://root-forum.cern.ch/t/pythia8-compliation-error-pythia8-pythia-h-not-found/50549/1 "2022-06-26T06:27:03Z")

</div>

Hello Experts

I tried to install pythia on linux, but my program does not work, however the examples does

```auto
~/pythia/pythia8307/examples$ make ptu1
g++ ptu1.cc -o ptu1
ptu1.cc:3:10: fatal error: Pythia8/Pythia.h: No such file or directory
    3 | #include "Pythia8/Pythia.h"
      | ^ ~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: ptu1] Error 1

```

I also tried with: g++ -I/home/shrey/Downloads/pythia/pythia8307/include ptu1.cc -o ptu1 -lpythia8 -L/home/shrey/Downloads/pythia/pythia8307/lib

And still the same error.  
Im relatively new to all this, any suggestions will help a lot.

Thanks

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [June 27, 2022, 8:02am UTC](https://root-forum.cern.ch/t/pythia8-compliation-error-pythia8-pythia-h-not-found/50549/2 "2022-06-27T08:02:36Z")

</div>

Hi @Shrey_Upadhyay ,

the compiler can’t find the `Pythia8/Pythia.h` header. The solution is usually to pass the path to the parent directory of the `Pythia8` directory to the compiler with the `-I` option.

Does `/home/shrey/Downloads/pythia/pythia8307/include` contain `Pythia8/Pythia.h`?

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![Shrey\_Upadhyay](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shrey_upadhyay/32/29457_2.png) [@Shrey\_Upadhyay](https://root-forum.cern.ch/u/Shrey_Upadhyay)\
**Post date:** [June 27, 2022, 10:37am UTC](https://root-forum.cern.ch/t/pythia8-compliation-error-pythia8-pythia-h-not-found/50549/3 "2022-06-27T10:37:22Z")

</div>

Thanks a lot for your reply

I was able to get pass the initial include error using:`g++ -I/home/shrey/pythia/pythia8307/include ptu1.cc -o ptu1 -lpythia8 -L/home/shrey/pythia/pythia8307/lib' but now get another error when I try to run the program using `./ptu1  
./ptu1: error while loading shared libraries: libpythia8.so: cannot open shared object file: No such file or directory  
`  
And yes /home/shrey/Downloads/pythia/pythia8307/include contain Pythia8/Pythia.h

Looking forward to your reply  
Thanks

---

<div class="post-metadata">

**Author:** ![Shrey\_Upadhyay](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shrey_upadhyay/32/29457_2.png) [@Shrey\_Upadhyay](https://root-forum.cern.ch/u/Shrey_Upadhyay)\
**Post date:** [June 27, 2022, 11:01am UTC](https://root-forum.cern.ch/t/pythia8-compliation-error-pythia8-pythia-h-not-found/50549/4 "2022-06-27T11:01:55Z")

</div>

Can the issue be due to ROOT? I’ve also have it installed.  
Can you please guide me on how to enable shared library in pythia

Thanks

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [June 27, 2022, 12:02pm UTC](https://root-forum.cern.ch/t/pythia8-compliation-error-pythia8-pythia-h-not-found/50549/5 "2022-06-27T12:02:32Z")

</div>

> [@Shrey\_Upadhyay](#):
>
> ./ptu1: error while loading shared libraries: libpythia8.so: cannot open shared object file: No such file or directory

Hi,

this is another common C++ compilation (or more precisely linking) issue which is not related to ROOT.  
At runtime the program is looking for the `libpythia8.so` shared library and it can’t find it in the `LD_LIBRARY_PATH`. Adding `/home/shrey/pythia/pythia8307/lib` to your `LD_LIBRARY_PATH` is one way to solve this problem. Searching the web or stackoverflow for “error while loading shared libraries” should provide more context/info.

Cheers,  
Enrico
