How to use Compile the Geant4 examples



Follow the commands on the use page to load the Geant4 environment.

In the following instructions we will compile the examples/basic/B5 example, but it could be any other available in $G4INSTALL/source/examples/. Replace -j4 with with -jN where N is the number of cores you want to use for the compilation.


mkdir build_B5
cd build_B5
cmake $G4INSTALL/source/examples/basic/B5
make -j4 

If you want to modify the example's code, we recommend to copy the example source directory somewhere and replace $G4INSTALL/source/examples/basic/B5 with the path to your new source directory.


More details on the examples are available in the Geant4 Examples Doxygen Page.