是因为截面库环境变量未设置,可以参考我前面win10安装geant4的博客进行设置。
同时当你在gitbash下运行geant4的bin目录下面geant4.sh文件时,可能提示,未找到data文件:
这是因为sh文件里面设置的$geant4_envbindir是你gitbash的目录:
if [ -z "$BASH_VERSION" ]; then
# Not bash, so rely on sourcing from correct location
if [ ! -f geant4.sh ]; then
echo 'ERROR: geant4.sh could NOT self-locate Geant4 installation'
echo 'This is most likely because you are using ksh, zsh or similar'
echo 'To fix this issue, cd to the directory containing this script'
echo 'and source it in that directory.'
return 1
fi
geant4_envbindir=$(pwd)
else
g4sls_sourced_dir=$(dirname ${BASH_ARGV[0]})
geant4_envbindir=$(cd $g4sls_sourced_dir > /dev/null ; pwd)
fi
上面else 部分$(dirname${BASH_ARGV[0]})的作用,dirname是取文件的上级目录,而BASH_ARGV[0]的0号参数,即BASHE.EXE程序本身。所以你需要把包含截面库文件data的share文件夹,拷贝到c:\Users目录下,这个时候gitbash运行geant4.sh成功