Hey,
Any Idea why this section of code would give me these linker errors using Visual Studio 05 in a console application and using winsock2.h:
error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "void __cdecl CloseDevice(void)" (?CloseDevice@@YAXXZ)
error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "void __cdecl CloseDevice(void)" (?CloseDevice@@YAXXZ)
error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "void __cdecl StartDevice(void)" (?StartDevice@@YAXXZ)
[LIST=1]
static int socket_fd; //Socket File Descriptor
bool portReady;
void StartDevice();
void CloseDevice();
void CloseDevice()
{
closesocket(socket_fd);
WSACleanup();
}
void StartDevice()
{
WSADATA wsaData;
int iResult;
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0)
{
portReady = false;
cout << "WSAStartup failed." << endl;
CloseDevice();
}
else
portReady = true;
}[/LIST]
Thanks.
Nemo