Results 1 to 4 of 4

Thread: QTcpServer: No such file or directory (Qt 4, SuSe 10)

  1. #1
    Join Date
    Feb 2006
    Posts
    25
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QTcpServer: No such file or directory (Qt 4, SuSe 10)

    I'm trying to create a QTcpServer inside a QThread. I get the error "QTcpServer: No such file or directory" error.

    The include path is not added to the Makefile when running the following:

    qmake -project
    qmake

    Has anyone seen this problem, if so, how would you go about solving it? Thanks in advanced.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer: No such file or directory (Qt 4, SuSe 10)

    Add "QT += network" to your .pro file.

  3. #3
    Join Date
    Feb 2006
    Posts
    25
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer: No such file or directory (Qt 4, SuSe 10)

    Thanks a lot for the help. This fixed my problem with the missing Include and Library.

    I am able to compile my code but when I run it I get the following error:

    ASSERT failure in QObject::QObject(): "Cannot create children for a parent that is in a different thread."

    The code is the following:

    Qt Code:
    1. mythread::mythread()
    2. {
    3. tcpServ = new QTcpServer(this);
    4. }
    5.  
    6. mythread::run()
    7. {
    8. while(isRunning())
    9. {
    10. tcpServ->listen();
    11. }
    12. exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    One more question. Since this is a different problem/question do I continue in this thread or is it best placed as a new thread?

    Thanks for the help.
    Last edited by wysota; 11th May 2006 at 00:09. Reason: Added [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer: No such file or directory (Qt 4, SuSe 10)

    Quote Originally Posted by freak
    ASSERT failure in QObject::QObject(): "Cannot create children for a parent that is in a different thread."
    When the constructor is executed that new thread doesn't exist yet (not mentioning that mythread object lives in a thread that created it). If you create an object in the constructor it will live in a wrong thread. Therefore you should create QTcpServer in mythread::run() (without a parent):
    Qt Code:
    1. mythread::run()
    2. {
    3. tcpServ = new QTcpServer();
    4. while(isRunning())
    5. {
    6. tcpServ->listen();
    7. }
    8. exec();
    9. }
    To copy to clipboard, switch view to plain text mode 

    http://doc.trolltech.com/4.1/threads.html

    Since this is a different problem/question do I continue in this thread or is it best placed as a new thread?
    Next time, please, start a new thread.

Similar Threads

  1. install help nedded.
    By aj2903 in forum Installation and Deployment
    Replies: 9
    Last Post: 13th November 2008, 07:57
  2. Replies: 3
    Last Post: 29th June 2007, 08:32
  3. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  4. errors while installing Qt4.2 in Linux
    By nimmyj in forum Installation and Deployment
    Replies: 11
    Last Post: 13th December 2006, 11:58
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.