Fatal error: Pythia8/Pythia.h: No such file or directory


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: ubuntu 20.04
Compiler: Not Provided


Hi, I’m trying to run a pythia code and I get this error: a.cc:3:10: fatal error: Pythia8/Pythia.h: No such file or directory
3 | #include “Pythia8/Pythia.h”
and this is the path: /pythia/pythia8307/include/Pythia8/Pythia.h
and this is my C++ code:


I read the other post about this problem and it didn’t help
can you please help me

When compiling your C++ code, add: -I/pythia/pythia8307/include

I did

Please have a look at the discussion here

-I/pythia/...!=-I/home/pythia/...

I’m sorry, but I did it too, and it appeared the same error

You MUST find the real full path to your Pythia 8 distribution.

This is the path: home/pythia/pythia8307/include/Pythia8/Pythia.h!

ls -al /home/pythia
ls -al /home/pythia/pythia8307
ls -al /home/pythia/pythia8307/include
ls -al /home/pythia/pythia8307/include/Pythia8
ls -al /home/pythia/pythia8307/lib

Hi @Abeda,

Uhm weird, then -I/home/pythia/pythia8307/include should work. Indeed you might want to check that the path contains the expected files as @Wile_E_Coyote suggests.

I checked the path and it contains the files

Attach the output of:
ls -al /home/pythia/pythia8307/include/Pythia8
ls -al /home/pythia/pythia8307/lib

but I did this too:

You do not have “/home/pythia” (nor “/pythia”) at all.

You need:
-I${HOME}/pythia/pythia8307/include
-L${HOME}/pythia/pythia8307/lib

well, It seems my path was not correct and it should be: home/user/pythia/pythia8307/include/Pythia8/Pythia.h
But now I get this error while compiling

You can try:

export PYTHIA8DATA=$(find ${HOME}/pythia -name xmldoc -type d -print)

ROOT Forum → Search → PYTHIA8DATA

pythia.org → Documentation

1 Like

Thanks a lot!! it works finally
can’t thank you enough

Hi again, I am trying to create a makefile but it shows the same error even though it works at the first step!
image
this is my makefile:

Hi @Abeda ,

this is not really a ROOT-related question: the compiler cannot find the header file because as you can see from the compilation command that make a triggers the -I compiler flag is missing: g++ a.cc -o a.

I guess you want make a1 instead?

Cheers,
Enrico

Hi @Abeda,

The pattern rule described in line 1 of your Makefile is not used; instead make is using an implicit rule to build the target, which obviously does not include all the additional command line options that you added. You might want to take a look also to Pattern Rules (GNU make).

Additionally, there are some other issues:

  • There should be no whitespace separating the -I compiler option and its argument
  • These paths should probably be absolute; you can consider using variables for this.

Cheers,
J.