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. using connect() for socket in a class that inherits QObject

using connect() for socket in a class that inherits QObject

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 502 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.
  • T Offline
    T Offline
    twall
    wrote on last edited by
    #1

    Hello, I'm working on an app that connects to a Unix Domain Socket as a client. The object that contains the socket is derived from a QObject. Because my object is a client, I would like to use the connect() call to connect to my IPC Server, however the program fails to compile, as it believes that I am attempting to use the QObject::connect() function to connect a signal and slot.

        if(connect(m_s1, (struct sockaddr *)&remote, len) == -1){
            perror("cannot connect");
            exit(1);
        }
    

    always fails with: /home/tom/Qt5.7.1/5.7/gcc_64/include/QtCore/qobject.h:251: error: invalid use of incomplete type ‘struct QtPrivate::QEnableIf<false, QMetaObject::Connection>’

    How can I go about using connect() to connect to a server? Thank you in advance

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

      Hi,

      Use ::connect. Doing so will start the name resolution in the global namespace which will find the method before the ones from QObject.

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

        excellent, thanks!

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved