Socket Server
-
Hi All, I used the following code to create a socket in my EVC++ program: #include "winsock.h" if (WSAStartup (MAKEWORD(1,1), &WSAData) != 0){ wsprintf (szError, TEXT("WSAStartup failed. Error: %d"), WSAGetLastError ()); MessageBox (hWnd, szError, TEXT("Error"), MB_OK); } if ((WinSocket = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { wsprintf (szError, TEXT("Allocating socket failed. Error: %d"), WSAGetLastError ()); MessageBox (hWnd, szError, TEXT("Error"), MB_OK); } I have no compile error but a link error that states : error LNK2019: unresolved external symbol _socket@12 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) It would be great if somebody could kindly help me out of this. Thanks and Regards, Deepa Gopal.:confused:
-
Hi All, I used the following code to create a socket in my EVC++ program: #include "winsock.h" if (WSAStartup (MAKEWORD(1,1), &WSAData) != 0){ wsprintf (szError, TEXT("WSAStartup failed. Error: %d"), WSAGetLastError ()); MessageBox (hWnd, szError, TEXT("Error"), MB_OK); } if ((WinSocket = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { wsprintf (szError, TEXT("Allocating socket failed. Error: %d"), WSAGetLastError ()); MessageBox (hWnd, szError, TEXT("Error"), MB_OK); } I have no compile error but a link error that states : error LNK2019: unresolved external symbol _socket@12 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) It would be great if somebody could kindly help me out of this. Thanks and Regards, Deepa Gopal.:confused:
Add
winsock.lib
to the list of Object/Library Modules in the Link tab in Project Settings. Stability. What an interesting concept. -- Chris Maunder