Sign in to follow this  
levijgraham

trying to use winsock2

Recommended Posts

Hey i am trying to run a simple chat program in c++ and a keep getting this error. Can anyone tell me how to fix it?


1>------ Build started: Project: RTS, Configuration: Debug Win32 ------
1>Build started 8/8/2011 5:43:59 PM.
1>InitializeBuildStatus:
1> Touching "Debug\RTS.unsuccessfulbuild".
1>ClCompile:
1> main.cpp
1> Socket.cpp
1>c:\users\levi\desktop\game\testfolder\rts\socket.cpp(19): warning C4551: function call missing argument list
1> Generating Code...
1>Socket.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function "public: bool __thiscall Socket::SendData(char *)" (?SendData@Socket@@QAE_NPAD@Z)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "public: bool __thiscall Socket::ReceiveData(char *,int)" (?ReceiveData@Socket@@QAE_NPADH@Z)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: void __thiscall Socket::CloseConnection(void)" (?CloseConnection@Socket@@QAEXXZ)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__accept@12 referenced in function "public: void __thiscall ServerSocket::Listen(void)" (?Listen@ServerSocket@@QAEXXZ)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__listen@8 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z)
1>Socket.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z)
1>C:\Users\levi\Desktop\Game\TestFolder\RTS\Debug\RTS.exe : fatal error LNK1120: 11 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.97
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Link to Ws2_32.lib


Project->Properties (Alt+F7)
Select Linker from the left pane, then Input.
Paste Ws2_32.lib in Additional Dependencies, then try a build.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this