Geant4 B1 Example Build Failure (Windows 10)

Greetings Geant4 Forum Users! I’m glad to be here.

I have been investigating different ways of simulating photon particle behaviours, and I recently stumbled upon the Geant4 program, and it capture my interest.

I’m a begginer with Linux/Unix, and I installed Geant4 on my Windows 10 machine.

I built the solution using Visual Studio 2019 Community Edition (in “Release” mode, as building it in “Debug” mode gives a library limit error). I followed this tutorial for Windows installation: Building and Installing from Source — Geant4 Installation Guide 11.0 documentation, and this tutorial for post-installation setup: Postinstall Setup — Geant4 Installation Guide 11.0 documentation. I “sourced” the installation by simply running the “geant4.bat” file from the Command Prompt.

To verify that I installed the program correctly, I wanted to build & run one of the basic examples, “B1”. However, I have been running into some issues, and wanted to see if I could get some guidance in the correct direction for fixing the issue;

Upon attempting to run the “cmake” command inside the “B1” example folder inside the “share” folder, I get the following:

I’m very confused as to why I’m getting this, as I thought that my Geant4 installation would be “sourced” already, but obviously I must have made a mistake somewhere along the way, and I want to correct it. I’m a begginer when it comes to things like these, and always open to learning!

Thank you in advance for reading my post, any guidance is greatly appreciated!

I think the bat will set the required variables only temporarily, so they are only valid for the currently open command prompt.

you could also follow the instructions on how to set the environment variables manually on the page that you linked in your post, i.e., add the “bin” dir of the installation destination to the “PATH”, set “Geant4_DIR” also to the “bin” directory, and then set all the dataset locations one by one.

Oh ok, that makes much more sense! Previously I had 2 separate CMD windows open, one for sourcing and one for building, and that’s why it wasn’t working. I need to do both the sourcing and the building in the same CMD window. Thank you for helping resolve that issue!

However, this runs into another problem, probably unrelated to the first question;

When I hit “cmake …” in the “B1” folder now, it attempts to build it, but it produces 100+ errors, stating that it cannot find & set properties to the library files…

I get about 100 or so error entries such as this:

…just for various library files, but they all say that they are missing, and they all reference the file “Geant4Config.cmake”.

After looking around the created Geant4 directories, I can see there are two variations of the “Geant4Config.cmake” file, one supposedly for release, and one for the debug version.

Is there an additional step I should have taken, aside from sourcing the “geant4.bat” file from the Command Prompt? As you pointed out in your previous reply, would you reccomend manually sourcing the file, and do you believe that would help resolve my issue?

Thank you in advance for reading my post.

Hello again, I managed to solve my problem!

The issue was happening because of the messy & incorrect setup I made, I originally watched a tutorial intended for Linux, while I was on a Windows platorm, and I was incorrectly sourcing the library entries.

After uninstalling & re-doing the whole process, according to this installation tutorial:

And after compiling the “B1” example according to this compiling tutoral:

I was able to finally get it to work.

Thanks to anyone who took the time to read and/or respond to my posting!

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