Skip to content

Build failure on Windows MSVC: error C7555 due to C++20 designated initializers #1669

Description

@dtristany

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions