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. I've tried below, and they didn't work: - Add `/utf-8` in `CMAKE_CXX_FLAGS` - Add additional code in G4Win32.cc & G4UIWin32.cc ``` #ifdef _UNICODE typedef wchar_t TCHAR; #else typedef char TCHAR; #endif ```
Koichi (or Evan), could you reassign to Laurent Garnier or John Allison please?
Sorry, can't help here.
Problem now fixed in the development branch. Fixes will be included in next patch release.
Created attachment 868 [details] Corrected file
Created attachment 869 [details] Corrected file
Hello, I have compiled the new release 11.2.2, but similar errors still occur on other files: - source\visualization\OpenGL\src\G4OpenGLWin32Viewer.cc - source\externals\g4tools\include\toolx\Windows\glarea I have corrected them and G4 compile and run correctly with Qt 6.6.2. You can find my patch attached. I cannot exclude that there could be other files with similar problems not used in my installation. Andrea