Can't get any visualisation drivers (openGl) to work

Completely new to Geant4 so sorry if this is a bit simple, but I can’t get any visualisation drivers set up. Tried setting up openGL, but I get this error when I run cmake.

CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/FindQt4.cmake:1314 (message):
Found unsuitable Qt version “” from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
cmake/Modules/Geant4InterfaceOptions.cmake:117 (find_package)
cmake/Modules/G4CMakeMain.cmake:64 (include)
CMakeLists.txt:50 (include)

– Configuring incomplete, errors occurred!
See also “C:/Users/Stephen/Geant4/geant4_10_06-build/CMakeFiles/CMakeOutput.log”.
See also “C:/Users/Stephen/Geant4/geant4_10_06-build/CMakeFiles/CMakeError.log”.

Seems to say I need Qt? But the documentation says you should only need openGl libraries and headers, which I’ve read come with most computers by default? Thanks in advance for any help

If you’ve run cmake with -DGEANT4_USE_QT=ON, then yes, you’ll need an install of Qt. On Windows, you can use the -DGEANT4_USE_OPENGL_WIN32=ON to enable GL visualisation. Installs of Visual Studio should come with the needed libraries for this driver.

Sorry if I wasn’t clear. This is the error that I’m getting when I run -DGEANT4_USE_OPENGL_WIN32=ON, which is why it’s so strange that it seems to be failing because I don’t have an install of Qt.

Right, but was -DGEANT4_USE_QT=ON set as well or is it set to ON in the CMakeCache.txt file in the build directory? The original error:

points to Line 117 in cmake/Modules/Geant4InterfaceOptions.cmake. That line is only triggered if GEANT4_USE_QT is ON.

However it got set, then running cmake again with -DGEANT4_USE_QT=OFF should deactivate the check.

1 Like

Yes I had set -DGEANT4_USE_QT=ON before, I changed it to off now and the build files for openGL were written without any problem. Thank you very much for the help!

Something that is both a feature and a problem with CMake is the cache file. It remembers all the options you last used, so you can come back and flip just one switch, while everything else stays as it was. But if you don’t remember the configuration you used before, that can be quite confusing.

If you need to back to square one, you can rm CMakeCache.txt, and the build will have no presets. That avoids the need to redownload and install everything.

You can also use the interactive ccmake utility to inspect all of your settings.

1 Like

Thanks very much for the advice, I’ll keep that in mind