[SOLVED] vtable issues while building Qt 5 app on OS X (CMake)
-
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!
-
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
-
I just noticed that QtC do underline Q_OBJECT in further declaration.
@
class MARBLE_EXPORT MarbleQuickItem : public QQuickPaintedItem
{
Q_OBJECTpublic: MarbleQuickItem(QQuickItem *parent = 0);
@
It says smth like skip identifier
Q_DECL_IMPORT
-
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 ?
-
I am using latest Qt from qt-project.org on OS X, building from stock QtC.
-
Latest official or beta ?
Which version of OS X/Xcode ? Where did you get Marble ?
-
Qt 5.3.2, official
OS X 10.9.5
Xcode 6.0.1
Git (KDE public git)
CMake 3.0.2 -
~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.
-
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 :)
-
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).
-
@Boris-Berzovsky How did you install Qt and QtCreator?
-
@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
-
@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?
-
@jsulm Perhaps you are right, for now I do not know. Thank:)