PDA

View Full Version : Migrating from Qt 4.8.x to 5.0.1



xEsk
2nd March 2013, 03:27
Hello,

I'm migrating a project from Qt 4.8.x to 5.0.1 and the only thing which I can say at this moment is "wow, it's not a trivial job!!" After some hard work (test & error), I solved almost all the "errors" (updating deprecated code, libs, etc...) but there are two errors which I'm not capable to fix (ouch!!).

I'm using the QMacCocoaViewContainer class (that compiles fine with Qt 4.8.x). Well, when I compile it using the Qt 5.0.1, the linker fails:


Undefined symbols for architecture x86_64:
"QMacCocoaViewContainer::qt_metacall(QMetaObject::C all, int, void**)", referenced from:
WebViewNative::qt_metacall(QMetaObject::Call, int, void**) in moc_WebKitClass.o
"QMacCocoaViewContainer::qt_metacast(char const*)", referenced from:
WebViewNative::qt_metacast(char const*) in moc_WebKitClass.o
"QMacCocoaViewContainer::setCocoaView(void*)", referenced from:
WebViewNative::WebViewNative(QWidget*) in WebKitClass.o
"QMacCocoaViewContainer::staticMetaObject", referenced from:
WebViewNative::staticMetaObject in moc_WebKitClass.o
"QMacCocoaViewContainer::QMacCocoaViewContainer(voi d*, QWidget*)", referenced from:
WebViewNative::WebViewNative(QWidget*) in WebKitClass.o
"QMacCocoaViewContainer::~QMacCocoaViewContainer()", referenced from:
WebViewNative::WebViewNative(QWidget*) in WebKitClass.o
WebViewNative::~WebViewNative() in moc_WebKitClass.o
"QMacCocoaViewContainer::cocoaView() const", referenced from:
WebViewNative::openURL(QString) in WebKitClass.o
"typeinfo for QMacCocoaViewContainer", referenced from:
typeinfo for WebViewNative in moc_WebKitClass.o
ld: symbol(s) not found for architecture x86_64
The .pro has not been changed and I understand what the error says but I don't understand why it happens. I missed some extra configuration for Qt 5? Is a Qt5 bug? Because the Qt 5 for Mac is only 64bits (downloaded from Internet, not compiled by me).

The specific configuration for this part in my project is:


LIBS += -framework Cocoa -framework WebKit
OBJECTIVE_SOURCES += src/webkit_mac/WebKitClass.mm
HEADERS += src/webkit_mac/WebKitClass.h
I'll omit the second error by now, at this moment is commented in my code and don't breaks my compilation process (I'll try to fix it after...) I need to fix this before.

Anyone know how to fix or why is it happening? Any help will be welcomed, I'm saturated at this time, hehehhe!

Best regards,
Xesc

Zlatomir
2nd March 2013, 08:43
You need to modify the .pro file and add QT += widgets -don't forget to run qmake after you add that- (there is a separate module for widgets in Qt 5) also you can read more here (http://qt-project.org/doc/qt-5.0/qtdoc/portingcppapp.html).

You can read more about Qt 5 modules here (http://qt-project.org/doc/qt-5.0/qtdoc/modules.html).

xEsk
2nd March 2013, 11:45
Thank you Zlatomir,

Thank you for your information, but I already added the QT += widgets in my PRO file and fixed all headers (I followed the information described here (http://qt-project.org/doc/qt-5.0/qtdoc/portingguide.html) and here (http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5)). I'm using the QtCreator 2.6.2 and Qt 5.0.1.

I also tried creating a small and clean project (via QtCreator 2.6.2) and added a dummy class that extends from QMacCocoaViewContainer class with same results Undefined symbols for architecture x86_64... bla bla.

I'm blocked here... :(

Best regards,
Xesc

Edit:

I found two posts related to mine: http://qt-project.org/forums/viewthread/25033 and http://qt-project.org/forums/viewthread/24654. Is there a Qt 5.0.1 bug?