Hello,
I'm working on a simple winsock2 messaging program with a client and a server.
The server, which uses the same code as the client, save for some preprocessor directives, compiles fine, but the client throws up 3 unresovled external symbol errors:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall Client::~Client(void)" (??1Client@@QAE@XZ) referenced in function _wmain Assignment 3 AIP 2 Client.obj
Error 2 error LNK2019: unresolved external symbol "public: int __thiscall Client::Connect(void)" (?Connect@Client@@QAEHXZ) referenced in function _wmain Assignment 3 AIP 2 Client.obj
Error 3 error LNK2019: unresolved external symbol "public: __thiscall Client::Client(void)" (??0Client@@QAE@XZ) referenced in function _wmain Assignment 3 AIP 2 Client.obj
I have linked the winsock2 library in both of the projects, but the client still throws up the errors. (Project->Properties->Configuration Properties->Linker->Input->Additional Dependencies->ws2_32.lib).
Any ideas as to why this might be?
Here is the code for the main function of the client:
#include "stdafx.h"
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iostream>
#include "windows.h"
#include "Client.h"
#include "Comms.h"
#include "Server.h"
#include <exception>
#include "Server.h"
#define CLIENT
//#define SERVER
char mutexName[] = "MUTEX1";
//*******************************************************
int _tmain(int argc, _TCHAR* argv[]){
#ifdef CLIENT
try{
Client myClient;
myClient.Connect();
}
catch( NoDllException& e){
cout << "Error 1 : " << e.what() << endl;
}
catch( ClientConnectException& e){
cout << "Error 2 : " << e.what() << endl;
}
catch( ClientSocketException& e){
cout << "Error 3 : " << e.what() << endl;
}
catch( ClientException& e){
cout << "Error 4 : " << e.what() << endl;
}
#endif
#ifdef SERVER
try{
Server myServer;
myServer.Listen();
}
catch( ServerSocketException& e){
cout << "Error 1 : " << e.what() << endl;
}
catch( BindFailedtException& e){
cout << "Error 2 : " << e.what() << endl;
}
catch( ListenErrorException& e){
cout << "Error 3 : " << e.what() << endl;
}
catch( SocketFailedException& e){
cout << "Error 4 : " << e.what() << endl;
}
catch( GameNameException& e){
cout << "Error 5 : " << e.what() << endl;
}
catch( RecieveClientException& e){
cout << "Error 6 : " << e.what() << endl;
}
catch( ServerSendException& e){
cout << "Error 7 : " << e.what() << endl;
}
#endif
system("pause");
return 0;
}
//*******************************************************