Error using Qt in window

Hello, I am using window 10,geant4_10_06_p02, visual studio 2019 and cmake-3.18.0
When I give these commends: -
cmake -DGEANT4_INSTALL_DATA=ON .
cmake -DGEANT4_USE_OPENGL_WIN32=ON .
cmake -DGEANT4_USE_QT=ON .
then everything is ok. It gives output like this


Then I gives cmake --build . --config Release this commend then I got error Error.txt (1.8 KB)
Please tell me what I am missing. Any suggestions will be appreciable.
Best
Kajal

Hello…
please help me to fix this.

Which Qt version is this, and how was it installed?

Thank you @bmorgan for replying.
I am using Qt 5.15.0 and I downloaded it from the link given in Geant4 installation Guide documentation https://www.qt.io/download-qt-for-application-development
by following this link I choose open source Qt use and then downloaded the Qt online installer.
I am also sharing the direct link of Qt online installer:-
https://www.qt.io/download-open-source?hsCtaTracking=9f6a2170-a938-42df-a8e2-a9f0b1d6cdce|6cb0de4f-9bb5-4778-ab02-bfb62735f3e5.
After downloading, and installing I set its path in the environment setting.
Then I gives these commends in visual studio commend prompt:-
cmake -DCMAKE_INSTALL_PREFIX="%HOMEPATH%\Geant4\geant4_10_06-install" "
˓→%HOMEPATH%\Geant4\geant4_10_06"
cmake -DGEANT4_INSTALL_DATA=ON .
cmake -DGEANT4_USE_QT=ON .
cmake -DGEANT4_USE_OPENGL_WIN32=ON .
I shared the results of these commends in my previous comment, which I got without any error.
Then I gave commend cmake --build . --config Release and I got error that I also shared in file Error.text. This error is too large I shared only few lines. If it is required then I can share full error.

Thanks for the info. Just to double check, do you have any other Qt installs on this system, and could you post the CMakeCache.txt file from your build directory please? We need to see that the correct Qt is being used and what CMake has found, if anything, before.

I have checked in my system, it have Qt 5.15.0 and Qt Creator 4.12.4 (Community).
I have no idea Qt Creator 4.12.4(Community) is part of Qt 5.15.0 or not. As I know it is not installed by me. Should I remove this please let me know.
I am also sharing the Cmake.Cache.txt file CMakeCache.txt (30.2 KB)
Thanks

I think CMake is finding the wrong install root for Qt. The key lines in the CMakeCache.txt are:

//The directory containing a CMake configuration file for Qt5Core.
Qt5Core_DIR:PATH=C:/Qt/5.15.0/mingw81_64/lib/cmake/Qt5Core

//The directory containing a CMake configuration file for Qt5Gui.
Qt5Gui_DIR:PATH=C:/Qt/5.15.0/mingw81_64/lib/cmake/Qt5Gui

//The directory containing a CMake configuration file for Qt5OpenGL.
Qt5OpenGL_DIR:PATH=C:/Qt/5.15.0/mingw81_64/lib/cmake/Qt5OpenGL

//The directory containing a CMake configuration file for Qt5PrintSupport.
Qt5PrintSupport_DIR:PATH=C:/Qt/5.15.0/mingw81_64/lib/cmake/Qt5PrintSupport

//The directory containing a CMake configuration file for Qt5Widgets.
Qt5Widgets_DIR:PATH=C:/Qt/5.15.0/mingw81_64/lib/cmake/Qt5Widgets

Which is Qt for the MinGW toolchain. For use with Visual Studio, those paths (I think) should begin with something like C:/Qt/5.15.0/msvc2019_64/. If that directory (C:/Qt/5.15.0/msvc2019_64/) is present on your system, then you can try:

  1. delete the CMakeCache.txt file
  2. Re-run CMake as you did before but with one additional argument, -DCMAKE_PREFIX_PATH="C:/Qt/5.15.0/msvc2019_64/"
    cmake -DCMAKE_INSTALL_PREFIX="%HOMEPATH%\Geant4\geant4_10_06-install"  -DGEANT4_INSTALL_DATA=ON - DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_WIN32=ON -DCMAKE_PREFIX_PATH="C:/Qt/5.15.0/msvc2019_64/" "%HOMEPATH%\Geant4\geant4_10_06"
    

This should point CMake to the right place (I don’t know why it would pick up MinGW first), so check the CMakeCache.txt for those paths first, then try rebuilding.

Thank You @bmorgan , I tried this and it works.
First I run basic example B1


which is ok, but when I tried other examples it gives error.
I am sharing the window of example B3.

The same error occurs in other example. Please help me to fix this.

Where did you run example B3 from? Does that directory contain the init_vis.mac and vis.mac files? These need to be present in the directory from which you run the executable (which doesn’t have to be the directory which holds the actual executable file).

Okay I got it. I should give the commend .\Release\exampleB3a.exe in the directory of B3a and on soon for other examples.
Thanks