Problem installing Geant 10.6 on Windows

Dear all,

I have tried to install the new version of Geant4 on my Windows PC, where I have previously installed the version 10.5, 10.4, 10.3 without problems (VS 2015).

Before doing that, I have downloaded the newer versions of Visual Studio (2019), Cmake (3.16.1), and Qt (5.12.6 - both msvc2017 and msvc2017_64).

When I run the building code, CMake finds this compiler (Hostx64/x64, is that right?):
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314 /bin/Hostx64/x64/cl.exe

Now, if I compile Geant with Qt msvc2017 I obtain an error during compilation that tells me that the version of Qt is x86 and the compilation is on x64.
Ok, I think, I’ll pass the msvc_64 directory of Qt.

It works fine, the compilation ends without errors.

BUT, when I try to compile my code, Visual Studio gives the error LNK1112 because it says that there is a file .obj created during the compilation of my project that is compiled in x64 (correct) and the target machine is x86 (not so correct)…
So, I tried to set the target machine at x64 in the Linker option (as it could be) and Visual Studio say that there are another file, “G4particles.lib(G4particles.dll)”, that are compiled in x86 and the target machine is x64 (why?)…

I don’t know how to solve this problem…

Can someone help me to fix this?

Thank you for your help


How are you compiling your code, and did it find the install of Geant4 that was built with x64? All I can think of is some accidental find of another Geant4 version. I’ll try and test myself, but may not be until new year.

I have compiled my code first generating the build with CMake from command line, and then I have compiled the solution with Visual Studio.
I have always used this procedurewith the previous versions of Geant, but all the installations were x86; now i wanted to try to install in x64 (with bad results…)

In in the meanwhile i have done other tests:

  1. I have tried to use the GUI of CMake to install Geant and to create the build of my project, to be able to control all the options…
    a. I have compiled Geant4 x64 without errors
    b. I have built and compiled my code x64 with VS without errors
    c. When i execute my project, Windows give me a message that say:“The application was unable to start correctly (0xc00007b)”

  2. I have tried to install Gean4 x86 using the GUI of CMake.
    All works fine: Geant4 compilation, My project compilation and also execution of the application.

So, there is some error in the building of my project when i use CMake with command line that is solved using the GUI, but there are also some problems to execute my x64 project…

Thank you for your help!


Note: I have also tried to compile an example (rdecay01), but the behavior is the same.

How is the application run, and can you check the value of PATH in the environment it runs under? The fact that it links but does not run (with an error that’s related to 32/64bit mismatch) could suggest the build time env is fine, but the runtime env is such that a mismatched library is picked up.

Found it!
When i have tried to reinstall Geant and my project at x86 with the GUI of cmake i have changed the PATH of Qt to the library at 32 bit, but when i have recompiled it at x64 i haven’t changed it again…

All works fine now!

Thank you for your asisstance!

P.S. I’d like to know why with the command line CMake does somenthing wrong, but on windows The GUI is very convenitent…

Hi Andrea,

I was just wondering how you uninstalled geant4 on the windows system? I have installed it and then done the post install setup but when I try to run the example b1 i get a missing .dll files error. So i am trying to reinstall it but I see no option to uninstall, also in the add/remove programs. Could you please help me out inthis


To “uninstall” Geant4, you just have to delete all the files in your install directory.
In addition, if you also want to recompile all the code, you must also delete all the files in the build directory.