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
Hello,
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.