Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML front end in CPP: compile/linker trouble
QtWS25 Last Chance

QML front end in CPP: compile/linker trouble

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 2.6k Views
  • 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.
  • G Offline
    G Offline
    ggwolf
    wrote on last edited by
    #1

    I am using VS2010 with qt 5.2.1

    I have been working on a UI in QML and trying to integrate it into my C++ project, I tried

    @#include <QDeclarativeView>@

    like "this suggests doing.":http://qt-project.org/doc/qt-4.8/qdeclarativeview.html#details

    however, I get compiler errors saying that QDeclarativeView cannot be found. so I googled and after adding

    @QT+= quick@

    didn't work,was tried a QQuickView instead. this time including QtQuick/QQuickView worked. so I tried the following

    @ QQuickView *view = new QQuickView;
    view->setSource(QUrl::fromLocalFile("main.qml");
    view->show();@

    and this gets all sorts of ridiculous linker errors, and now I have no idea what to try.

    @2>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QQuickView::setSource(class QUrl const &)" (_imp?setSource@QQuickView@@QAEXABVQUrl@@@Z) referenced in function "public: __thiscall MainWindow::MainWindow(void)" (??0MainWindow@@QAE@XZ)
    2>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QQuickView::QQuickView(class QWindow *)" (_imp??0QQuickView@@QAE@PAVQWindow@@@Z) referenced in function "public: __thiscall MainWindow::MainWindow(void)" (??0MainWindow@@QAE@XZ)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QQuickView::metaObject(void)const " (?metaObject@QQuickView@@UBEPBUQMetaObject@@XZ)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QQuickView::qt_metacast(char const *)" (?qt_metacast@QQuickView@@UAEPAXPBD@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QQuickView::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QQuickView@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QQuickWindow::event(class QEvent *)" (?event@QQuickWindow@@MAE_NPAVQEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickView::timerEvent(class QTimerEvent *)" (?timerEvent@QQuickView@@MAEXPAVQTimerEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual class QAccessibleInterface * __thiscall QQuickWindow::accessibleRoot(void)const " (?accessibleRoot@QQuickWindow@@UBEPAVQAccessibleInterface@@XZ)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual class QObject * __thiscall QQuickWindow::focusObject(void)const " (?focusObject@QQuickWindow@@UBEPAVQObject@@XZ)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickWindow::exposeEvent(class QExposeEvent *)" (?exposeEvent@QQuickWindow@@MAEXPAVQExposeEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickView::resizeEvent(class QResizeEvent *)" (?resizeEvent@QQuickView@@MAEXPAVQResizeEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickWindow::focusInEvent(class QFocusEvent *)" (?focusInEvent@QQuickWindow@@MAEXPAVQFocusEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickWindow::focusOutEvent(class QFocusEvent *)" (?focusOutEvent@QQuickWindow@@MAEXPAVQFocusEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickWindow::showEvent(class QShowEvent *)" (?showEvent@QQuickWindow@@MAEXPAVQShowEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickWindow::hideEvent(class QHideEvent *)" (?hideEvent@QQuickWindow@@MAEXPAVQHideEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickView::keyPressEvent(class QKeyEvent *)" (?keyPressEvent@QQuickView@@MAEXPAVQKeyEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickView::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QQuickView@@MAEXPAVQKeyEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickView::mousePressEvent(class QMouseEvent *)" (?mousePressEvent@QQuickView@@MAEXPAVQMouseEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickView::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent@QQuickView@@MAEXPAVQMouseEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickWindow::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent@QQuickWindow@@MAEXPAVQMouseEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickView::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent@QQuickView@@MAEXPAVQMouseEvent@@@Z)
    2>MainWindow.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QQuickWindow::wheelEvent(class QWheelEvent *)" (?wheelEvent@QQuickWindow@@MAEXPAVQWheelEvent@@@Z)
    2>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QQuickView::~QQuickView(void)" (_imp??1QQuickView@@UAE@XZ) referenced in function "public: virtual void * __thiscall QQuickView::`scalar deleting destructor'(unsigned int)" (??_GQQuickView@@UAEPAXI@Z)@

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Can you try putting QT += qml quick as well ? Suggest you clean and rebuild. Can you try creating the QtQuick UI application itself ? This puts all the necessary things for you.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • G Offline
        G Offline
        ggwolf
        wrote on last edited by
        #3

        QT += qml quick placed, tried a clean and rebuild, same linker errors. What do you mean by create the application itself?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          ggwolf
          wrote on last edited by
          #4

          Never mind, My problem is related to Visual Studio's property sheets mess because of the way my project is setup. I have to follow some other steps to link correctly.

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

            Try
            @
            #include <QtQuick>
            @

            157

            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