Results 1 to 7 of 7

Thread: Please Help, QTcpSocket class use

  1. #1
    Join Date
    Jul 2010
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Please Help, QTcpSocket class use

    hello, i am new to Qt. i am trying to implement a client server application.



    i get error messages for one line of code!!





    this is my code.



    i have included the <QtNetwork/QTcpSocket> class



    code:



    QTcpSocket socket;

    socket.connectToHost("Local Host",5000);





    thats it.



    i am using qt creator 4.6, with the option to design UI interface too.



    these are the errors



    undefined reference to '_imp__ZN10QTcpSocketC1EP7QObject'

    similar to the above 10 errors!



    please help!!
    Attached Files Attached Files
    Last edited by aash_89; 12th July 2010 at 18:55.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Please Help, QTcpSocket class use

    Quote Originally Posted by aash_89 View Post
    undefined reference to '_imp__ZN10QTcpSocketC1EP7QObject'
    That's a linker error. It means that it can't find a certain function or class in the libraries it has access to (or knows about).

    Why you get this error is not easy to answer with the explanation you gave. So please post your complete code, including your .pro file and explain exactly how you build your code. Are you using Qt Creator for example?

  3. #3
    Join Date
    Jul 2010
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Please Help, QTcpSocket class use

    Also, please try to load one of Qt Examples with networking such as Fortune Client Example, and just try to build it. Perhaps something wasn't configured properly during your installation of Qt.

  4. #4
    Join Date
    Jul 2010
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Please Help, QTcpSocket class use

    Thank you for the prompt reply.
    I just executed the fortune server client application, it worked perfectly.

    Yes i am using Qt creator, i just make an interface, and then go to the source file, type the code and say build, it automatically executes!

    i will upload my .pro file

  5. #5
    Join Date
    Jul 2010
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Please Help, QTcpSocket class use

    In the example(fortune), they include QtNetwork class.

    how ever when i do the same, its not possile.

    i have to use QtNetwork/QtNetwork.

    or even if i need to used QTCPsocket class

    i need to say QtNetwork/QTCPsocket

    is that the problem?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Please Help, QTcpSocket class use

    Do you have "QT += network" line in your project file?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jul 2010
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Please Help, QTcpSocket class use

    thank you. thats what i was missing! i figured it out a while back! thankx anyway.

    now have it working!

Similar Threads

  1. Replies: 5
    Last Post: 20th April 2010, 17:48
  2. QTcpSocket as class member of QThread Issue
    By zyangxue in forum Qt Programming
    Replies: 4
    Last Post: 12th December 2009, 06:42
  3. Replies: 3
    Last Post: 27th December 2008, 19:34
  4. Replies: 3
    Last Post: 16th May 2007, 11:07
  5. Signal/slot looking in base class, not derived class
    By georgie in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2006, 07:36

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.