Click to See Complete Forum and Search --> : "Undefined reference to: " errors in Qt Creator


AwArEnEsS
October 24th, 2009, 06:18 PM
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?

AwArEnEsS
October 24th, 2009, 07:28 PM
This is a program which uses winsock.h.

Joeman
October 25th, 2009, 03:34 AM
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.

AwArEnEsS
October 26th, 2009, 07:28 PM
Thanks!