Solved undefined reference to QAbstractSocket::resume(), connectToHost() & setSocketDescriptor()
-
Hello,
I try to port an application initally developped with QtCreator using Qt 4.8.7 to Qt 5.7.1 on a Arm platform under Armbian.
The compilation of the project seems to go well, but at the end of the buid process i get the errors (linker kind)
undefined reference to 'QAbstractSocket::resume()'
undefined reference to 'QAbstractSocket::connectToHost(...)'
undefined reference to 'QAbstractSocket:: setSocketDescriptor(..)'someone can help me?
regards -
@pas059
When you port from Qt 4 to Qt 5 there are certain changes which require code alteration. Have you started by reading https://doc.qt.io/qt-5/portingguide.html & https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5 ?Though the functions you mention are still in Qt 5....
-
Hello JonB
thanks for your fast reply. I had read the contents of these links that cencern my app; this had implied just few changes at source level for me.
After making the source level changes, i had only errors of type 'undefined reference' for methods relative to QtNetwork. So i added the line:unix|win32: LIBS += -lQtNetwork
in my .pro file, than after this it remains only the 3 errors above. Perhaps i forgot to add something else in the .pro file.
regards
-
@pas059
Sorry, I don't do this area myself.QAbstractSocket
says it wantsqmake: QT += network
, assuming your line covers that I don't know why it would be complaining about just those functions, if it's not linking with "network" you'd think there would be other things left with undefined reference. But you need a more knowledgeable Qt-er than me.P.S.
I think you're supposed to putQT += network
into your.pro
file. -
Hello,
Thanks you very much JonB, this was the problem: adding QT += network in my .pro file (and remove unix|win32: LIBS += -lQtNetwork) solves the problem. In fact, i had simply copied the line from the .pro file used with Qt4.8.7. You understood, i'm not a Qt expert, but now i will be able to move forward.
regards
-
@pas059
Glad you're solved. I'm no expert either, plus I don't use Qt Creator/C++/builds/makes/.pro
etc. :) But I think putting thatQT += network
into your.pro
does more then just theLIBS += -lQtNetwork
. For example, ifQAbstractSocket
stuff is in an additional network library file,QT += network
may cause extra stuff to be brought in, or flags, or whatever....