Get Geant4 version number in C++ code


Is there a preprocessor macro or some other easy way to get the Geant4 version number during the Geant4 C++ code execution ?

We are trying to run our Geant4 code in different systems, and it is not easy to ensure that all systems have the same version of Geant4 installed (due to different versions of OS / gcc / cmake on different systems). If I could retrieve the version using the Geant4 executable and save it in the output file, it would be very helpful for debugging purposes.


A G4VERSION_NUMBER macro is available in G4Version.hh, plus some string constants if those are more suited.

Perfect. That is exactly what I was looking for. Thanks so much !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.