I saw many other similar questions, but I just could not understand this problem with their help. I realized that this is a binding problem, but from what I see, I have a straightened connection.
I am writing a chat server / client (using in this article ).
I defined a class for storing server functions and a header file that handles all incoming messages.
This is the header file:
#include <windows.h> #include <winsock.h> #include <stdio.h> #include <tchar.h> #include <strsafe.h> #include "resource1.h" class ChatServer { public: int InitServer(HINSTANCE hInst); public: void ReportError(int errorCode, const char *whichFunc); };
This is the actual server class:
#include "server.h" #define NETWORK_ERROR -1 #define NETWORK_OK 0
Finally, the main.cpp file with the entry method for the program calls "ChatServer :: InitServer (g_hInst)". It is quite large, so I omitted it, but if necessary, I will publish it as well.
The error messages I get are similar to the ones below, but all of them pose problems with the api functions associated with the winsockets API:
Error 3 error LNK2019: unresolved external symbol _closesocket@4 referenced in function "public: int __thiscall ChatServer::InitServer(struct HINSTANCE__ *)" ( ?InitServer@ChatServer @@ QAEHPAUHINSTANCE__@ @@Z)
As I said before, I believe this problem is related to the compiler, not understanding what to do with functions like "closesocket" that should be associated with winsock.h.
Thanks for any advice and thanks for reading all this gibberish :)