# Geant4 compling error of a repo

**URL:** <https://root-forum.cern.ch/t/geant4-compling-error-of-a-repo/43073>\
**Category:** Newbie\
**Created:** [January 12, 2021, 11:48am UTC](https://root-forum.cern.ch/t/geant4-compling-error-of-a-repo/43073 "2021-01-12T11:48:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cangunes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/cangunes/32/24559_2.png) [@cangunes](https://root-forum.cern.ch/u/cangunes)\
**Post date:** [January 12, 2021, 11:48am UTC](https://root-forum.cern.ch/t/geant4-compling-error-of-a-repo/43073/1 "2021-01-12T11:48:26Z")

</div>

Dear user,

i am just a beginner user on Geant4. i have to tried LaBr3 code via [https://github.com/giglio0/DRAGON-G4-LaBr3.git](https://github.com/giglio0/DRAGON-G4-LaBr3.git). after the configuration while creating build files with make command, the process send a error message.

Scanning dependencies of target LaBr3\_v4  
[9%] Building CXX object CMakeFiles/LaBr3\_v4.dir/LaBr3\_v4.cc.o  
[18%] Building CXX object CMakeFiles/LaBr3\_v4.dir/src/DetectorConstruction.cc.o  
[27%] Building CXX object CMakeFiles/LaBr3\_v4.dir/src/DetectorMessenger.cc.o  
[36%] Building CXX object CMakeFiles/LaBr3\_v4.dir/src/EventAction.cc.o  
[45%] Building CXX object CMakeFiles/LaBr3\_v4.dir/src/HistoManager.cc.o  
/home/cancan/Gatev9/example\_Geant4/LaBr/LaBr3/src/HistoManager.cc:29:10: fatal error: TH1D.h: No such file or directory  
29 | #include \<TH1D.h\>  
| ^ ~~~~~~~  
compilation terminated.  
make[2]: \*\*\* [CMakeFiles/LaBr3\_v4.dir/build.make:134: CMakeFiles/LaBr3\_v4.dir/src/HistoManager.cc.o] Error 1  
make[1]: \*\*\* [CMakeFiles/Makefile2:95: CMakeFiles/LaBr3\_v4.dir/all] Error 2  
make: \*\*\* [Makefile:149: all] Error 2

in the begining i thought it was about root libraries so that i re-install the root with use “-Dall=ON”. i hoped it could be fix the error but couldn’d. After that, i checked the Cmakelist of the repo but like i said before i coundn’t see HistoManager.cc file list of the sources. maybe you thing i am silly but i said before i am just beginer so i added source directory of histomanager.cc among of source list in cmakelist.txt file. Of course it wasn’t also work.

list(APPEND sources  
{PROJECT\_SOURCE\_DIR}/src/DetectorConstruction.cc {PROJECT\_SOURCE\_DIR}/src/DetectorMessenger.cc  
{PROJECT\_SOURCE\_DIR}/src/EventAction.cc {PROJECT\_SOURCE\_DIR}/src/PhysicsList.cc  
{PROJECT\_SOURCE\_DIR}/src/PrimaryGeneratorAction.cc {PROJECT\_SOURCE\_DIR}/src/RunAction.cc  
{PROJECT\_SOURCE\_DIR}/src/SteppingAction.cc {PROJECT\_SOURCE\_DIR}/src/TrackingAction.cc)

Can anbody help me?

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [January 12, 2021, 11:50am UTC](https://root-forum.cern.ch/t/geant4-compling-error-of-a-repo/43073/2 "2021-01-12T11:50:28Z")

</div>

We don’t know the G4 build system that well. Maybe calling `source wherever/your/ROOT/is/bin/thisroot.sh` before running `cmake` on the G4 build will fix this? Else please check with the Geant forum!

---

<div class="post-metadata">

**Author:** ![cangunes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/cangunes/32/24559_2.png) [@cangunes](https://root-forum.cern.ch/u/cangunes)\
**Post date:** [January 12, 2021, 12:02pm UTC](https://root-forum.cern.ch/t/geant4-compling-error-of-a-repo/43073/3 "2021-01-12T12:02:32Z")

</div>

you are right and i also shared my error with Geant forum. accually i created this topic because i wanted to learn that if i want to install all libraries of root, is it enough add [-Dall=ON] to continue the cmake command when i configurate the the root.

---

<div class="post-metadata">

**Author:** ![bmorgan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bmorgan/32/13719_2.png) [@bmorgan](https://root-forum.cern.ch/u/bmorgan)\
**Post date:** [January 12, 2021, 3:38pm UTC](https://root-forum.cern.ch/t/geant4-compling-error-of-a-repo/43073/4 "2021-01-12T15:38:48Z")

</div>

I think this is likely due to changes to ROOT’s `ROOTConfig.cmake` file (the repo in question is 4yrs old). The error:

> [@cangunes](#):
>
> [45%] Building CXX object CMakeFiles/LaBr3\_v4.dir/src/HistoManager.cc.o  
> /home/cancan/Gatev9/example\_Geant4/LaBr/LaBr3/src/HistoManager.cc:29:10: fatal error: TH1D.h: No such file or directory  
> 29 | #include \<TH1D.h\>  
> | ^ ~~~~~~~

is pointing to the include directory(ies) for ROOT not being added to the build. See the ROOT docs here:

> **[Integrating ROOT into CMake projects](https://root.cern/manual/integrate_root_into_my_cmake_project/)**
>
> Data Analysis Framework

and check that the correct CMake variables/target are being used in the project’s `CMakeLists.txt`.
