[Installation Error] Install with Qt6 in Windows

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

Geant4 Version: 11.2 & 11.2.patch1
Operating System: Windows 11
Compiler/Version: MSVC 2022
CMake Version: 3.28.0-msvc1


I’ve been experiencing compilation issues while attempting to install Geant4 versions 11.2 (and also 11.2.patch1) with Qt6 on a Windows 11 environment. The errors arise primarily from type conversion conflicts between char arrays and LPCWSTR in the G4Win32.cc and G4UIWin32.cc source files. These errors suggest that conversions or casts are necessary to proceed with the installation.

Below are the specific error messages encountered during the build process:

For G4Win32.cc:

C:\geant4\geant4-v11.2.1\source\interfaces\implementation\src\G4Win32.cc(68,23): error C2440: '=': cannot convert from 'char [8]' to 'LPCWSTR'
C:\geant4\geant4-v11.2.1\source\interfaces\implementation\src\G4Win32.cc(69,24): error C2440: '=': cannot convert from 'char [8]' to 'LPCWSTR'
C:\geant4\geant4-v11.2.1\source\interfaces\implementation\src\G4Win32.cc(73,9): error C2664: 'HWND CreateWindowExW(DWORD,LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID)': cannot convert argument 2 from 'char [8]' to 'LPCWSTR'

For G4UIWin32.cc:

C:\geant4\geant4-v11.2.1\source\interfaces\implementation\src\G4UIWin32.cc(101,23): error C2440: '=': cannot convert from 'char [10]' to 'LPCWSTR'
C:\geant4\geant4-v11.2.1\source\interfaces\implementation\src\G4UIWin32.cc(102,24): error C2440: '=': cannot convert from 'char [10]' to 'LPCWSTR'
C:\geant4\geant4-v11.2.1\source\interfaces\implementation\src\G4UIWin32.cc(105,7): error C2664: 'int MessageBoxW(HWND,LPCWSTR,LPCWSTR,UINT)': cannot convert argument 2 from 'const char [45]' to 'LPCWSTR'

It is noteworthy that these issues do not occur under same installation options on Ubuntu, nor do they arise when integrating Geant4 11.2 and 11.2.patch1 with Qt5 on Windows 11, where the installation completes successfully.

Has anyone encountered similar issues or possesses insights on resolving these specific type conversion errors when using Geant4 with Qt6 on Windows 11? Any advice or suggestions would be greatly appreciated as I navigate through these installation challenges.

Thank you in advance for your help and insights.

As Qt6 support is still preliminary, we aren’t testing on Windows platforms just yet. Could you submit a ticket on our Bugzilla system so that the relevant experts can take a look please?

I’ve submitted the bug report as suggested. This issue was something I’ve been aware of since the 11.2.beta, and in hindsight, I realize I should have reported it sooner.
Thank you for your guidance on this matter.

1 Like

Thanks! Just to cross reference for other people: 2599 – [Installation Error] Install with Qt6 in Windows

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