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

Error: undefined reference to QQuickRectangle::QQuickRectangle(QQuickItem*)



  • I want to use Qt Quick 2 directly from C++ without those qml/javascript stuffs that could slows down the app, but i got compilation error when using QQuickRectangle.

    In .pro file i have: QT += quick quick-private core-private gui-private declarative-private qml-private

    and in .cpp file - #include <private/qquickrectangle_p.h>

    I compiled the Qt 5.5 from sources and the command nm -D /usr/local/Qt-5.5.0/lib/libQt5Quick.so.5 | grep "Rectangle"
    doesn't print anything related to QQuickRectangle, so it looks that it is not included in the shared library, but i don't know why, because the qquickrectangle.cpp exists in qt sources, so it should be included in the shared library after compilation.



  • Hi,

    without those qml/javascript stuffs that could slows down the app,

    have you proof of that? Best practice is to write your code; test profile and then optimize slow parts.

    In .pro file i have: QT += quick quick-private core-private gui-private declarative-private qml-private
    and in .cpp file - #include <private/qquickrectangle_p.h>

    you're using private classes that are not exposed in the public libraries


Log in to reply