当我尝试构建编译时出现 cmake 错误?

时间:2021-01-10 22:52:52

标签: c++ linux cmake geant4

我试图通过“https://github.com/giglio0/DRAGON-G4-LaBr3.git”来编译存储库,但在编译时,我出错了。我不知道这是为什么?我不是编码员。只是我想构建这个存储库并通过更改一些参数来运行模拟。错误输出为;

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

有人可以帮我吗?

2 个答案:

答案 0 :(得分:0)

显然你需要安装ROOT库,见:https://root.cern.ch/doc/master/classTH1.html

顺便说一句,您要编译的应用程序 DRAGON-G4-LaBr3 的 READ.me 很糟糕。

答案 1 :(得分:-1)

根据您的建议,我使用此命令再次安装 root-6.22.06;

cmake -DCMAKE_INSTALL_PREFIX=/home/cancan/Gatev9/root-6.22.06-install /home/cancan/Gatev9/root-6.22.06 -Dall=ON

我从某处了解到,如果我使用“-Dall=ON”,我可以安装所有 root 库,但它仍然无法正常工作。