Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User prchakal's Avatar
    Join Date
    Mar 2009
    Posts
    22
    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
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    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 prchakal's Avatar
    Join Date
    Mar 2009
    Posts
    22
    Hi man.

    I got the same error:



    Im using QT 4.6 and QT Creator 1.3

  4. #4
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Then it's time to share your sample code.

  5. #5
    Registered User prchakal's Avatar
    Join Date
    Mar 2009
    Posts
    22
    Problem solved, i forgot put:

    #include <QTcpSocket>

    On the header file.

    Thx.

  6. #6
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    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
    Nokia Developer Champion axeljaeger's Avatar
    Join Date
    Mar 2009
    Posts
    430
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved