For Windows 11 users, I believe many friends will love this working environment just like I do. The overall installation and compilation configuration are quite simple, and it’s also very convenient to use VS Code to call gdb for debugging.
I shared this installation method a few years ago( Visualization in WSL2 ), and now I’m documenting it again.
-
Configure WSL2
-
Install Ubuntu from Microsoft Store
-
System prerequisites and Geant4 installation(Only QT5 selected for visualiztion)
-
prerequisites and support libraries installation
sudo apt-get updatesudo apt-get install build-essential cmake gdb libexpat-dev qt5-qmake qtbase5-dev qt5-qmake-bin qtbase5-dev-tools -
Geant4 build and installation
tar -xf geant4-v11.3.2.tar.gz (In your path e.g. ‘/mnt/f/ubuntu24/g4/’)mkdir g4_installmkdir g4_buildcd g4_buildcmake -DCMAKE_INSTALL_PREFIX=/mnt/f/ubuntu24/g4/g4_install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON /mnt/f/ubuntu24/g4/geant4-v11.3.2make -j8make installvi ~/.bashrcsource /mnt/f/ubuntu24/g4/g4_install/share/Geant4/geant4make/geant4make.shsource /mnt/f/ubuntu24/g4/g4_install/bin/geant4.sh
-
-
VS Code configuration
1\. In the WSL2 console
code .
2\. VS Code
extensions installation: C/C++, CMake Tools (e.g. Install in WSL:Ubuntu-24.04)
Some screenshots:
*Geant4 Version:*Geant4-11.3.2
Operating System:Win11+WSL2+Ubuntu20.04/22.04/24.04LTS
*Compiler/Version:*system compiler-GCC 11.4 for Ubuntu20.04/22.04 and GCC 13.3 for Ubuntu24.04
CMake Version:3.24.0 for Ubuntu20.04 / 3.22.1 for Ubuntu22.04 / 3.28.3 for Ubuntu24.04


