Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-131425

When I build the project using C++ 20 Modules, the xxx.moc file generated by MOC encounters compilation and linking errors!

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8
    • Build tools: moc
    • None
    • Windows 10
      LLVM 19.1.3
    • All

    Description

      [build] In module 'MenuBar' imported from C:/Workspace/VSCode_Workspace/Test005/MainWindow.ixx:16:
      [build] C:/Qt/6.8.0/msvc2022_64/include\QtCore/qtmochelpers.h:31:25: error: declaration 'MaxStringSize' attached to named module 'MenuBar' can't be attached to other modules
      [build]    31 | static constexpr size_t MaxStringSize =
      [build]       |                         ^
      [build] C:/Qt/6.8.0/msvc2022_64/include\QtCore/qtmochelpers.h:31:25: note: also found
      [build]    31 | static constexpr size_t MaxStringSize =
      [build]       |                         ^
      [build] In module 'MenuBar' imported from C:/Workspace/VSCode_Workspace/Test005/MainWindow.ixx:16:
      [build] C:/Qt/6.8.0/msvc2022_64/include\QtCore/qtmochelpers.h:35:40: error: declaration 'stringDataSizeHelper' attached to named module 'MenuBar' can't be attached to other modules
      [build]    35 | template <uint... Nx> constexpr size_t stringDataSizeHelper(std::integer_sequence<uint, Nx...>)
      [build]       |                                        ^
      [build] C:/Qt/6.8.0/msvc2022_64/include\QtCore/qtmochelpers.h:35:40: note: also found
      [build]    35 | template <uint... Nx> constexpr size_t stringDataSizeHelper(std::integer_sequence<uint, Nx...>)
      [build]       |                                        ^
      [build] In module 'MenuBar' imported from C:/Workspace/VSCode_Workspace/Test005/MainWindow.ixx:16:
      [build] C:/Qt/6.8.0/msvc2022_64/include\QtCore/qtmochelpers.h:35:40: error: declaration 'stringDataSizeHelper' attached to named module 'MenuBar' can't be attached to other modules
      [build]    35 | template <uint... Nx> constexpr size_t stringDataSizeHelper(std::integer_sequence<uint, Nx...>)
      [build]       |                                        ^
      [build] C:/Qt/6.8.0/msvc2022_64/include\QtCore/qtmochelpers.h:35:40: note: also found
      [build]    35 | template <uint... Nx> constexpr size_t stringDataSizeHelper(std::integer_sequence<uint, Nx...>)
      [build]       |                                        ^

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            fabiankosmale Fabian Kosmale
            paul-xu Paul Xu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes