Problem with sockets

Hi guys, I am trying a TCP/IP protocol and I have this errors in all methods, what i try:



1>socket.obj : error LNK2001: unresolved external symbol _accept@12
1>socket.obj : error LNK2001: unresolved external symbol _listen@8
1>socket.obj : error LNK2001: unresolved external symbol _send@16
1>socket.obj : error LNK2001: unresolved external symbol _gethostbyname@4
1>socket.obj : error LNK2001: unresolved external symbol _closesocket@4
1>socket.obj : error LNK2001: unresolved external symbol _getservbyname@8
1>socket.obj : error LNK2001: unresolved external symbol _socket@12
1>socket.obj : error LNK2001: unresolved external symbol _bind@12
1>socket.obj : error LNK2001: unresolved external symbol _recv@16
1>socket.obj : error LNK2001: unresolved external symbol _WSACleanup@0
1>socket.obj : error LNK2001: unresolved external symbol _sendto@24
1>socket.obj : error LNK2001: unresolved external symbol _setsockopt@20
1>socket.obj : error LNK2001: unresolved external symbol _getsockname@12
1>socket.obj : error LNK2001: unresolved external symbol _ntohs@4
1>socket.obj : error LNK2001: unresolved external symbol _htons@4
1>socket.obj : error LNK2001: unresolved external symbol _htonl@4
1>socket.obj : error LNK2001: unresolved external symbol _inet_addr@4
1>socket.obj : error LNK2001: unresolved external symbol _recvfrom@24
1>socket.obj : error LNK2001: unresolved external symbol _WSAStartup@8
1>socket.obj : error LNK2001: unresolved external symbol _inet_ntoa@4
1>socket.obj : error LNK2001: unresolved external symbol _connect@12
1>socket.obj : error LNK2001: unresolved external symbol _getpeername@12


And i don't know what this errors mean.
I am learning from Examples:
http://cs.baylor.edu/~donahoo/practical/CSockets/practical/

I am using Visual Studio 2010, but i have this errors in all compilers/writers (Code::Blocks,Dev cpp etc.)
Last edited on
The linker can't find those functions. Have you added the (correct) library path to your lib directories?
You need to link with ws2_32.lib
I added #pragma comment(lib,"Ws2_32.lib") to my code and it's works, thanks :)
Topic archived. No new replies allowed.