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. undefined reference to QAbstractSocket::resume(), connectToHost() & setSocketDescriptor()
Forum Updated to NodeBB v4.3 + New Features

undefined reference to QAbstractSocket::resume(), connectToHost() & setSocketDescriptor()

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 901 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.
  • P Offline
    P Offline
    pas059
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • P pas059

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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....

      1 Reply Last reply
      2
      • P Offline
        P Offline
        pas059
        wrote on last edited by
        #3

        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

        JonBJ 1 Reply Last reply
        0
        • P pas059

          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

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @pas059
          Sorry, I don't do this area myself. QAbstractSocket says it wants qmake: 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 put QT += network into your .pro file.

          1 Reply Last reply
          5
          • P Offline
            P Offline
            pas059
            wrote on last edited by
            #5

            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

            JonBJ 1 Reply Last reply
            1
            • P pas059

              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

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @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 that QT += network into your .pro does more then just the LIBS += -lQtNetwork. For example, if QAbstractSocket stuff is in an additional network library file, QT += network may cause extra stuff to be brought in, or flags, or whatever....

              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