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

syntax error: ';' was unexpected here

    XMLWordPrintable

Details

    • Windows
    • b4c17476129e07dd3bf52c6aac8a51cf30c2dd3a (qt/qtbase/dev)

    Description

      When adding a QQmlComponent as a Q_PROPERTY I have the following issue on windows with msvc compiler:

      /FoSources\Engine\Canvas\CMakeFiles\EngineCanvas.dir\EngineCanvas_autogen\mocs_compilation.cpp.obj /FdSources\Engine\Canvas\CMakeFiles\EngineCanvas.dir\ /FS -c Sources\Engine\Canvas\EngineCanvas_autogen\mocs_compilation.cpp
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2261): error C2187: syntax error: ';' was unexpected here
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2261): note: while compiling class template static data member 'const QtPrivate::QMetaTypeInterface QtPrivate::QMetaTypeInterfaceWrapper<Ty>::metaType'
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2317): note: see reference to class template instantiation 'QtPrivate::QMetaTypeInterfaceWrapper<Ty>' being compiled
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(2378): note: see reference to function template instantiation 'const QtPrivate::QMetaTypeInterface *QtPrivate::qMetaTypeInterfaceForType<T>(void)' being compiled
              with
              [
                  T=QQmlComponent *
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(1125): note: see reference to function template instantiation 'QMetaType QMetaType::fromType<T>(void)' being compiled
              with
              [
                  T=QQmlComponent *
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtCore/qmetatype.h(1149): note: see reference to function template instantiation 'int qRegisterNormalizedMetaType<T>(const QByteArray &)' being compiled
              with
              [
                  T=QQmlComponent *
              ]
      C:\Qt\6.0.0\msvc2019_64\include\QtQml/qqmlcomponent.h(165): note: see reference to function template instantiation 'int qRegisterMetaType<QQmlComponent*>(const char *)' being compiled

       

      Edit:

      As mentioned in the comment below: the issue seems to comes from including the QQuickItem header. I've added a very basic cmake + main that cause the issue.

      Attachments

        1. main.cpp
          0.2 kB
        2. CMakeLists.txt
          0.4 kB

        Activity

          People

            ulherman Ulf Hermann
            jirauser37625 user-3288b (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: