When building on Windows using MSVC (eg via GitHub Actions) the build fails during the compilation of main_widget.cpp. The compiler throws an error regarding the use of designated initializers, which are a C++20 feature.
Currently, pdf_viewer_build_config.pro globally sets CONFIG += c++17. MSVC strictly enforces standard flags and refuses to compile C++20 syntax under a C++17 configuration.
Error Log
D:\a\sioyek\sioyek\pdf_viewer\main_widget.cpp(11158,9): error C7555: use of designated initializers requires at least '/std:c++20' [D:\a\sioyek\sioyek\sioyek.vcxproj]
D:\a\sioyek\sioyek\pdf_viewer\main_widget.cpp(11164,9): error C7555: use of designated initializers requires at least '/std:c++20' [D:\a\sioyek\sioyek\sioyek.vcxproj]
To reproduce the behavior run a Windows build using MSVC and Qt 6.11.
Proposed Fix
Update pdf_viewer_build_config.pro to append /std:c++20 to QMAKE_CXXFLAGS inside the win32 block. This satisfies MSVC's requirement for designated initializers without altering the standard for macOS and Linux builds.
When building on Windows using MSVC (eg via GitHub Actions) the build fails during the compilation of
main_widget.cpp. The compiler throws an error regarding the use of designated initializers, which are a C++20 feature.Currently,
pdf_viewer_build_config.proglobally setsCONFIG += c++17. MSVC strictly enforces standard flags and refuses to compile C++20 syntax under a C++17 configuration.Error Log
To reproduce the behavior run a Windows build using MSVC and Qt 6.11.
Proposed Fix
Update
pdf_viewer_build_config.proto append/std:c++20toQMAKE_CXXFLAGSinside thewin32block. This satisfies MSVC's requirement for designated initializers without altering the standard for macOS and Linux builds.