问题描述
我正在对 geant4 中的 HPGe 探测器进行简单的模拟。 我已经为简单的 HPGe 探测器配置编写了代码。 我在哪里写过代码 1.hpgeDetector构造 2.hpgePhysicslists 3.hpgePrimaryActionGenerator
头文件和 C++ 文件。我也为此编写了主程序。 我写了CMakeLists.txt执行cmake的代码,如下:
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(hpge)
#----------------------------------------------------------------------------
# Find Geant4 package,activating all available UI and Vis drivers by default
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
# to build a batch mode only executable
#
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
if(WITH_GEANT4_UIVIS)
find_package(Geant4 required ui_all vis_all)
else()
find_package(Geant4 required)
endif()
#----------------------------------------------------------------------------
# Setup Geant4 include directories and compile deFinitions
# Setup include directory for this project
#
include(${Geant4_USE_FILE})
include_directories(${PROJECT_SOURCE_DIR}/include)
#----------------------------------------------------------------------------
# Locate sources and headers for this project
# NB: headers are included so they will show up in IDEs
#
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable,and link it to the Geant4 libraries
#
add_executable(hpge hpge_main.cc ${sources} ${headers})
target_link_libraries(hpge ${Geant4_LIBRARIES})
#----------------------------------------------------------------------------
# copy all scripts to the build directory,i.e. the directory in which we
# build hpge. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(HPGE_SCRIPT
hepgeDet.in
hpgeDet.out
init_vis.mac
run1.mac
run2.mac
vis.mac
)
foreach(_script ${HPGE_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
copYONLY
)
endforeach()
#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this
# example standalone
#
add_custom_target(hpgeDet DEPENDS hpge)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS hpge DESTINATION bin)
当我运行命令 cmake <path>
时,它成功执行。之后,我将执行 make -j4
来构建目标。它向我显示了错误:
Scanning dependencies of target hpge
[ 20%] Building CXX object CMakeFiles/hpge.dir/hpge_main.cc.o
/home/subhrod/G4_project/HPGe_design/hpge_main.cc:1:10: Fatal error: G4RunManagerFactory.hh: No such file or directory
1 | #include "G4RunManagerFactory.hh"
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/hpge.dir/build.make:63: CMakeFiles/hpge.dir/hpge_main.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/hpge.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
subhrod@subhrod-HP-Pavilion-x360-Convert
请帮助我,我怎样才能让我的系统检测到 geant4 的头文件。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)