Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error using Wt and Qt in Qt Creator



  • Hi Guys

    I need to use Wt and Qt at the same time... in my .pro file I set this:

    INCLUDEPATH += /usr/local/include
    LIBS += -L/usr/local/lib -lwt -lwthttp

    and when I try to compile my code i got this error:

    In file included from ../qt_wt_learn/main.cpp:1:
    In file included from ../qt_wt_learn/MainWindow.h:4:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/QMainWindow:1:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qmainwindow.h:37:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:41:
    In file included from /usr/local/include/QtGui/qpalette.h:47:
    In file included from /usr/local/include/QtGui/qbrush.h:53:
    In file included from /usr/local/include/QtGui/qpixmap.h:49:
    In file included from /usr/local/include/QtCore/qsharedpointer.h:50:
    /usr/local/include/QtCore/qsharedpointer_impl.h:435:17: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
    register int tmp = o->strongref;
    ^~~~~~~~~
    /usr/local/include/QtCore/qsharedpointer_impl.h:822:5: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
    register X *ptr = static_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
    ^~~~~~~~~
    /usr/local/include/QtCore/qsharedpointer_impl.h:834:5: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
    register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
    ^~~~~~~~~
    /usr/local/include/QtCore/qsharedpointer_impl.h:848:5: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
    register X *ptr = const_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
    ^~~~~~~~~
    /usr/local/include/QtCore/qsharedpointer_impl.h:868:5: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
    register X *ptr = qobject_cast<X *>(src.data());
    ^~~~~~~~~
    In file included from ../qt_wt_learn/main.cpp:1:
    In file included from ../qt_wt_learn/MainWindow.h:4:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/QMainWindow:1:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qmainwindow.h:37:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:45:
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:46:5: error: expected expression
    Q_GADGET
    ^
    /usr/local/include/QtCore/qobjectdefs.h:173:18: note: expanded from macro 'Q_GADGET'
    #define Q_GADGET
    ^
    In file included from ../qt_wt_learn/main.cpp:1:
    In file included from ../qt_wt_learn/MainWindow.h:4:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/QMainWindow:1:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qmainwindow.h:37:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:45:
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: error: variable has incomplete type 'class Q_WIDGETS_EXPORT'
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:7: note: forward declaration of 'Q_WIDGETS_EXPORT'
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2356:32: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    Q_DECL_CONSTEXPR inline QFlagsFlags::enum_type operator|(Flags::enum_type f1, Flags::enum_type f2)
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2356:60: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    Q_DECL_CONSTEXPR inline QFlagsFlags::enum_type operator|(Flags::enum_type f1, Flags::enum_type f2)
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2356:81: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    Q_DECL_CONSTEXPR inline QFlagsFlags::enum_type operator|(Flags::enum_type f1, Flags::enum_type f2)
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2357:17: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    { return QFlagsFlags::enum_type(f1) | f2; }
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2358:32: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    Q_DECL_CONSTEXPR inline QFlagsFlags::enum_type operator|(Flags::enum_type f1, QFlagsFlags::enum_type f2)
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2358:60: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    Q_DECL_CONSTEXPR inline QFlagsFlags::enum_type operator|(Flags::enum_type f1, QFlagsFlags::enum_type f2)
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2358:88: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    Q_DECL_CONSTEXPR inline QFlagsFlags::enum_type operator|(Flags::enum_type f1, QFlagsFlags::enum_type f2)
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:158:31: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
    ^
    /usr/local/include/QtCore/qglobal.h:2359:50: note: expanded from macro 'Q_DECLARE_OPERATORS_FOR_FLAGS'
    { return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
    ^
    /usr/local/include/QtCore/qglobal.h:2352:36: note: expanded from macro 'Q_DECLARE_INCOMPATIBLE_FLAGS'
    inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2)
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:162:18: error: variable has incomplete type 'Q_WIDGETS_EXPORT'
    Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:7: note: forward declaration of 'Q_WIDGETS_EXPORT'
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:162:29: error: expected ';' after top level declarator
    Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
    ^
    ;
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:163:18: error: redefinition of 'QDataStream'
    Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:162:18: note: previous definition is here
    Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:163:29: error: expected ';' after top level declarator
    Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
    ^
    ;
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:167:18: error: variable has incomplete type 'Q_WIDGETS_EXPORT'
    Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &);
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:7: note: forward declaration of 'Q_WIDGETS_EXPORT'
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:167:24: error: expected ';' after top level declarator
    Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &);
    ^
    ;
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:170:13: error: 'QSizePolicy' is not a class, namespace, or scoped enumeration
    inline void QSizePolicy::transpose() {
    ^
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:44:24: note: 'QSizePolicy' declared here
    class Q_WIDGETS_EXPORT QSizePolicy
    ^
    In file included from ../qt_wt_learn/main.cpp:1:
    In file included from ../qt_wt_learn/MainWindow.h:4:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/QMainWindow:1:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qmainwindow.h:37:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:48:
    /usr/local/include/QtGui/qcursor.h:171:14: error: must use 'class' tag to refer to type 'QDataStream' in this scope
    Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
    ^
    class
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:162:18: note: class 'QDataStream' is hidden by a non-type declaration of 'QDataStream' here
    Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
    ^
    In file included from ../qt_wt_learn/main.cpp:1:
    In file included from ../qt_wt_learn/MainWindow.h:4:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/QMainWindow:1:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qmainwindow.h:37:
    In file included from /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:48:
    /usr/local/include/QtGui/qcursor.h:171:38: error: must use 'class' tag to refer to type 'QDataStream' in this scope
    Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
    ^
    class
    /Applications/Qt5.4.1/5.4/clang_64/lib/QtWidgets.framework/Headers/qsizepolicy.h:162:18: note: class 'QDataStream' is hidden by a non-type declaration of 'QDataStream' here
    Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
    ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    5 warnings and 20 errors generated.
    make: *** [main.o] Error 1
    13:48:21: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project qt_wt_learn (kit: Desktop Qt 5.4.1 clang 64bit)
    When executing step "Make"

    It seem like if the signal/slot Qt's mechanism has conflict with Wt...

    how can I fix this ??

    Best regards

    PD: Sorry for not mark the code error... I don't know how do this in the new forum GUI.


  • Lifetime Qt Champion

    Hi,

    I haven't tried it but this example from Wt might get you started

    Hope it helps


Log in to reply