×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    22

    Exclamation Error on use QTcpServer

    Hi ppl,

    Im trying make a TcpServer with QTcpServer, but i get a error. Im follow this example:

    http://qt.nokia.com/doc/4.6/network-fortuneserver.html

    I get the errors:



    "tcpServerConnection" is declared on header as "QTcpSocket *tcpServerConnection".

    If i comment the line where i get the error it compile normal:
    "connect(tcpServerConnection, SIGNAL(disconnected()), tcpServerConnection, SLOT(deleteLater()));"

    The problem is when i try use the object "tcpServerConnection".

    I cant do anything with it that i get an error and the code complete doesnt work when i try:
    "tcpServerConnection->"

    The fortune server example works fine, but mine not o.o

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Error on use QTcpServer

    My guess is that your defined ServerDialog::connect(...) and now C++ compiler are not able to decide, which method you are trying to call. Use fully qualified name:
    Code:
    QObject::connect(tcpServerConnection, SIGNAL(disconnected()), tcpServerConnection, SLOT(deleteLater()));

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    22

    Re: Error on use QTcpServer

    Hi man.

    I got the same error:



    Im using QT 4.6 and QT Creator 1.3

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Error on use QTcpServer

    Then it's time to share your sample code.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    22

    Re: Error on use QTcpServer

    Problem solved, i forgot put:

    #include <QTcpSocket>

    On the header file.

    Thx.

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Error on use QTcpServer

    Strange. In my understanding in such a case you should have other build errors before QObject::connect. But good that this is resolved now.

    Quote Originally Posted by prchakal View Post
    Problem solved, i forgot put:

    #include <QTcpSocket>

    On the header file.

    Thx.

  7. #7
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    430

    Re: Error on use QTcpServer

    The explanation why this is the only error is that QTcpSocket was forward declared and the only thing the compiler needs to know from the header file is that QTcpSocket somehow inherits QObject.

Similar Threads

  1. Erron IN receiving MMS
    By vikas_nsit in forum General Messaging
    Replies: 0
    Last Post: 2007-01-19, 12:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×