Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] vtable issues while building Qt 5 app on OS X (CMake)
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] vtable issues while building Qt 5 app on OS X (CMake)

Scheduled Pinned Locked Moved General and Desktop
14 Posts 4 Posters 4.6k 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.
  • T Offline
    T Offline
    tucnak
    wrote on last edited by
    #1

    Hey there,

    Haven't touched Qt for a while and trying to build a Qt 5 application now (marble). Just experienced a little trouble, while shooting another one. MarbleQuickItem is a class over QQuickItem, there was a compiler issue, smth like "QQuickItem.h" is not found.

    I basically added two lines to root CMakeLists.txt:
    @
    find_package(Qt5Quick REQUIRED)
    include_directories( ${Qt5Quick_INCLUDE_DIRS} )
    @

    And it actually worked finally! On the other hand, I still can't understand how it worked on other systems 0_O (w/o Qt5Quick includes). Now I have a compiler output:

    @
    Undefined symbols for architecture x86_64:
    "QQuickItem::itemChange(QQuickItem::ItemChange, QQuickItem::ItemChangeData const&)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::touchEvent(QTouchEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::wheelEvent(QWheelEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::focusInEvent(QFocusEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::updatePolish()", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::dragMoveEvent(QDragMoveEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::focusOutEvent(QFocusEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::keyPressEvent(QKeyEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::dragEnterEvent(QDragEnterEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::dragLeaveEvent(QDragLeaveEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::hoverMoveEvent(QHoverEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::mouseMoveEvent(QMouseEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::geometryChanged(QRectF const&, QRectF const&)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::hoverEnterEvent(QHoverEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::hoverLeaveEvent(QHoverEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::keyReleaseEvent(QKeyEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::mousePressEvent(QMouseEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::inputMethodEvent(QInputMethodEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::mouseUngrabEvent()", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::releaseResources()", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::staticMetaObject", referenced from:
    Marble::AbstractDataPlugin::handleViewportChange(Marble::ViewportParams const*) in AbstractDataPlugin.o
    "QQuickItem::touchUngrabEvent()", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::mouseReleaseEvent(QMouseEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o
    "QQuickItem::childMouseEventFilter(QQuickItem*, QEvent*)", referenced from:
    vtable for Marble::MarbleQuickItem in marblewidget_automoc.o

    ... etc, etc, etc, it actually covers all inherited members.
    @

    Dunno, imho, the bug lies on the ground, but I can't see it any way :. Thanks in advance!

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

      Hi,

      That generally happens when you re-compile a QObject derived class after adding Q_OBJECT but without running qmake so it's marked to be moc'ed. But well it doesn't really make sense in your case… Might be a starting anyway

      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
      • T Offline
        T Offline
        tucnak
        wrote on last edited by
        #3

        I just noticed that QtC do underline Q_OBJECT in further declaration.

        @
        class MARBLE_EXPORT MarbleQuickItem : public QQuickPaintedItem
        {
        Q_OBJECT

        public:
            MarbleQuickItem(QQuickItem *parent = 0);
        

        @

        It says smth like skip identifier Q_DECL_IMPORT

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

          MARBLE_EXPORT will resolve to Q_DECL_IMPORT depending if you are building the library or using it (have a look at it's implementation)

          Are you using your distribution Qt ?

          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
          • T Offline
            T Offline
            tucnak
            wrote on last edited by
            #5

            I am using latest Qt from qt-project.org on OS X, building from stock QtC.

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

              Latest official or beta ?

              Which version of OS X/Xcode ? Where did you get Marble ?

              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
              • T Offline
                T Offline
                tucnak
                wrote on last edited by
                #7

                Qt 5.3.2, official
                OS X 10.9.5
                Xcode 6.0.1
                Git (KDE public git)
                CMake 3.0.2

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tucnak
                  wrote on last edited by
                  #8

                  ~SGaist, thanks to Earthwings, I finally came to a solution. It's about linking ${Qt5Quick_LIBRARIES} against the CMake target. I've done only including so far.

                  Hate myself for doing such baby mistakes. Thanks.

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

                    Well, indeed, the compiler will be really less likely to cooperate if you're missing that :)

                    Don't worry, can happen to anybody.

                    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

                    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
                    • T tucnak

                      ~SGaist, thanks to Earthwings, I finally came to a solution. It's about linking ${Qt5Quick_LIBRARIES} against the CMake target. I've done only including so far.

                      Hate myself for doing such baby mistakes. Thanks.

                      B Offline
                      B Offline
                      Boris Berzovsky
                      wrote on last edited by
                      #10

                      @tucnak @SGaist

                      Welcome colleagues. So what, where is the specific solution to the problem?

                      I realized that software versions affect this error. What exactly needs to be updated or vice versa (use more version)?
                      How to find out compatible versions of qmake and qt?

                      I would ask to specify step by step, otherwise it was not at all a solved task (maybe qmake needs to be updated ..).

                      Versions of my software -

                      Qt 5.11.2, official.
                      OS X 10.13.6(High Sierra).
                      Xcode 10.0 (10A255).
                      QMake 3.1.

                      Using Qt-Creator version 4.7.1(based on QT 5.11.2).

                      Also, can you tell me why there are no project settings in QTCreator? And also the official examples from QT were not delivered, the QT folder itself is missing, where examples and the QTCreator development environment are usually stored. I can not open projects, I can not understand what is missing (and maybe the version should use an older QTCreator?). On another computer I put everything exactly the same, but everything was fine there (QTCreator version was earlier, namely 4.5.0).

                      jsulmJ 1 Reply Last reply
                      0
                      • B Boris Berzovsky

                        @tucnak @SGaist

                        Welcome colleagues. So what, where is the specific solution to the problem?

                        I realized that software versions affect this error. What exactly needs to be updated or vice versa (use more version)?
                        How to find out compatible versions of qmake and qt?

                        I would ask to specify step by step, otherwise it was not at all a solved task (maybe qmake needs to be updated ..).

                        Versions of my software -

                        Qt 5.11.2, official.
                        OS X 10.13.6(High Sierra).
                        Xcode 10.0 (10A255).
                        QMake 3.1.

                        Using Qt-Creator version 4.7.1(based on QT 5.11.2).

                        Also, can you tell me why there are no project settings in QTCreator? And also the official examples from QT were not delivered, the QT folder itself is missing, where examples and the QTCreator development environment are usually stored. I can not open projects, I can not understand what is missing (and maybe the version should use an older QTCreator?). On another computer I put everything exactly the same, but everything was fine there (QTCreator version was earlier, namely 4.5.0).

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @Boris-Berzovsky How did you install Qt and QtCreator?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        B 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @Boris-Berzovsky How did you install Qt and QtCreator?

                          B Offline
                          B Offline
                          Boris Berzovsky
                          wrote on last edited by
                          #12

                          @jsulm
                          1)first rolled Homebrew
                          2)brew install qt
                          3)brew link qt5 --force
                          4)then you need to specify the path, execute the command, it will appear right there in the request.

                          5)brew cask install qt-creator

                          could forget something, but everything seems to be

                          jsulmJ 1 Reply Last reply
                          0
                          • B Boris Berzovsky

                            @jsulm
                            1)first rolled Homebrew
                            2)brew install qt
                            3)brew link qt5 --force
                            4)then you need to specify the path, execute the command, it will appear right there in the request.

                            5)brew cask install qt-creator

                            could forget something, but everything seems to be

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @Boris-Berzovsky I'm not MacOS user, so don't know whether "brew install qt" installs everything you need to develop with Qt? Maybe you need to install dev packages as well?

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            B 1 Reply Last reply
                            1
                            • jsulmJ jsulm

                              @Boris-Berzovsky I'm not MacOS user, so don't know whether "brew install qt" installs everything you need to develop with Qt? Maybe you need to install dev packages as well?

                              B Offline
                              B Offline
                              Boris Berzovsky
                              wrote on last edited by Boris Berzovsky
                              #14

                              @jsulm Perhaps you are right, for now I do not know. Thank:)

                              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