CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2009
    Posts
    40

    "Undefined reference to: " errors in Qt Creator

    Hello,this is my first post on this forum.

    I started using Qt Creator(on Windows) and I have a problem.I found a source code(pure c++) on internet,and tried it to compile with Qt Creator(chose build item from the menu) .It gave these problems:

    "
    ...PracSockWin.cpp:39: undefined reference to `gethostbyname@4'
    ...PracSockWin.cpp:47: undefined reference to `htons@4'
    ...PracSockWin.cpp:62: undefined reference to `socket@12'
    ...PracSockWin.cpp:88: undefined reference to `inet_ntoa@4'
    "
    It found many of these type errors,what should I do?

  2. #2
    Join Date
    Oct 2009
    Posts
    40

    Re: "Undefined reference to: " errors in Qt Creator

    This is a program which uses winsock.h.

  3. #3
    Join Date
    Jun 2008
    Posts
    592

    Re: "Undefined reference to: " errors in Qt Creator

    Wouldn't it be nicer to use the qt network module since qt is cross-platform and you're using qt...

    http://doc.trolltech.com/4.0/qt4-network.html

    If you're going to use winsock, which in this case I wouldn't recommend, you need to link the lib Ws2_32.
    0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
    0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000
    0000 0000 0000 0000

  4. #4
    Join Date
    Oct 2009
    Posts
    40

    Re: "Undefined reference to: " errors in Qt Creator

    Thanks!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured