Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [solved] Compiler errors after transition from Qt4.x project to Qt5.x on OSX
Forum Updated to NodeBB v4.3 + New Features

[solved] Compiler errors after transition from Qt4.x project to Qt5.x on OSX

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 2 Posters 6.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hardcodes.de
    wrote on last edited by
    #1

    I've tried to change a project that just runs/compiles fine with Qt4.8.x (gcc and clang) to Qt5.0.x (tried clang 5.0.1 and clang 5.0.2).
    Checked for changes to .PRO file from
    http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5
    and used the fixqt4headers.pl script, which didn't find any includes that needed a change.

    On compiling I receveive an error from one of the qmake generated moc files:

    @
    clang++ -c -pipe -mmacosx-version-min=10.6 -g -gdwarf-2 -Wall -W -fPIE -DHC_PROGRAMVERSION="0.1.0" -DHC_GITHASH="9f49f3a1ed09e462b1051e790e3898fa57467550" -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../Qt5.0.2/5.0.2/clang_64/mkspecs/macx-clang -I../../../Dropbox/private/Qt/SolMan -I../../../devtools/taglib-bin/include/taglib -I../../../devtools/boost_1_53_0 -I../../../Qt5.0.2/5.0.2/clang_64/include -I../../../Qt5.0.2/5.0.2/clang_64/include/QtWidgets -I../../../Qt5.0.2/5.0.2/clang_64/lib/QtWidgets.framework/Versions/5/Headers -I../../../Qt5.0.2/5.0.2/clang_64/include/QtGui -I../../../Qt5.0.2/5.0.2/clang_64/lib/QtGui.framework/Versions/5/Headers -I../../../Qt5.0.2/5.0.2/clang_64/include/QtCore -I../../../Qt5.0.2/5.0.2/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -I. -I. -o moc_itunesconnector.o moc_itunesconnector.cpp
    In file included from moc_itunesconnector.cpp:9:
    In file included from ./../../../Dropbox/private/Qt/SolMan/itunesconnector.h:4:
    In file included from ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/QObject:1:
    In file included from ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qobject.h:55:
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qmetatype.h:642:5: error: implicit instantiation of undefined template 'QStaticAssertFailure<false>'
    Q_STATIC_ASSERT_X(QMetaTypeId2<T>::Defined, "Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system");
    ^
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qglobal.h:642:47: note: expanded from macro 'Q_STATIC_ASSERT_X'
    #define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition)
    ^
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qglobal.h:641:76: note: expanded from macro 'Q_STATIC_ASSERT'
    enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, LINE) = sizeof(QStaticAssertFailure<!!(Condition)>)}
    ^
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qmetatype.h:656:12: note: in instantiation of function template specialization 'qMetaTypeId<QList<QUrl> *>' requested here
    return qMetaTypeId(dummy);
    ^
    moc_itunesconnector.cpp:137:50: note: in instantiation of function template specialization 'qRegisterMetaType<QList<QUrl> >' requested here
    reinterpret_cast<int>(_a[0]) = qRegisterMetaType< QList<QUrl>
    >(); break;
    ^
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qglobal.h:635:28: note: template is declared here
    template <bool Test> class QStaticAssertFailure;
    ^
    In file included from moc_itunesconnector.cpp:9:
    In file included from ./../../../Dropbox/private/Qt/SolMan/itunesconnector.h:4:
    In file included from ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/QObject:1:
    In file included from ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qobject.h:55:
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qmetatype.h:534:82: error: no member named 'qt_metatype_id' in 'QMetaTypeId<QList<QUrl> *>'
    static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
    ~~~~~~~~~~~~~~~~^
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qmetatype.h:643:29: note: in instantiation of member function 'QMetaTypeId2<QList<QUrl> *>::qt_metatype_id' requested here
    return QMetaTypeId2<T>::qt_metatype_id();
    ^
    ../../../Qt5.0.2/5.0.2/clang_64/include/QtCore/qmetatype.h:656:12: note: in instantiation of function template specialization 'qMetaTypeId<QList<QUrl> *>' requested here
    return qMetaTypeId(dummy);
    ^
    moc_itunesconnector.cpp:137:50: note: in instantiation of function template specialization 'qRegisterMetaType<QList<QUrl> >' requested here
    reinterpret_cast<int>(_a[0]) = qRegisterMetaType< QList<QUrl>
    >(); break;
    ^
    2 errors generated.
    make: *** [moc_itunesconnector.o] Error 1
    21:40:53: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project SolMan (kit: Qt 5.0.2 Desktop clang 64bit)
    When executing step 'Make'
    @

    The build directory was completely empty before compiling, no left traces from 4.8.x compiles.

    What else do I need to change for a successful compile? And yes, QList and QUrl are included.

    while(!sleep){++sheep;}

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you have the Q_DECLARE_METATYPE statements somewhere in your code ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hardcodes.de
        wrote on last edited by
        #3

        No, I didn't even know what that was until I got those errors.

        while(!sleep){++sheep;}

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hardcodes.de
          wrote on last edited by
          #4

          I've "filed a bug":https://bugreports.qt-project.org/browse/QTBUG-31002 because it can be reproduced with a quite small test project.

          while(!sleep){++sheep;}

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Do you also have that with Qt 5.1 ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hardcodes.de
              wrote on last edited by
              #6

              Yes, even with the latest version from Git.
              If I read the first answer to the bug-report right, then it is a bug.

              while(!sleep){++sheep;}

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hardcodes.de
                wrote on last edited by
                #7

                Bug was "fixed":https://codereview.qt-project.org/#change,56445
                Didn't have the time to pull/compile but I will mark this here as solved anyway.

                while(!sleep){++sheep;}

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hardcodes.de
                  wrote on last edited by
                  #8

                  Pulled/compiled qt5 from git and yes, the bug is gone :-D

                  while(!sleep){++sheep;}

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Great ! :)

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved