How to add libaries such as #include <th1f.h>

Hello guys, i am new to root and pythia and i am confused.

i have downloaded root software and installed it through brew since i am using mac os and i have downloaded pythia8.3

i have made some run test to check if i had installed it correctly and the run test went well.

then i have downloaded another file to make another run but it gave me this error
main023.cc:14:10: fatal error: ‘TH1F.h’ file not found
#include <TH1F.h>

i know that there is missing package i need to install it (because there more includes in main023), so my question how i can install these packages ? or there is anyway that the terminal can detect the missing packages and install it automatically?

i cant upload file cause my account is new

Hi,
When building your program main023.cc you should pass the include Path, by using root-config --cflags:

g++ -c `root-config --cflags` main023.cc

Lorenzo

after running the command line above it gives me
main023.cc:9:10: fatal error: ‘Pythia8/Pythia.h’ file not found
#include “Pythia8/Pythia.h”
^~~~~~~~~~~~~~~~~~
1 error generated.

where this path should be relative main023.cc

i think the make command doesnt get the path of my include files
what shall i do?

Hi,
You need to add the Path to Pythia8 in your Makefile, or to your compilation command:

g++ -c `root-config --cflags`  -I${PYTHIA_INCLUDE_DIR} main023.cc

where PYTHIA_INCLUDE_DIR defines the include path to Pythia8.

@Samer_hisham
I believe that I’m trying to run the same file which is main023.cc but I got your same problems and can’t solve it. If that worked with you can you tell me what you did?

I even used the answers given by @moneta and getting the error:
g++: fatal error: no input files
Although I made sure I’m in the folder with the main023.cc

I’m using Ubuntu 22.04 with root 6.26.04 and pythia 8.307