I created programs transferring information between client and server by C++ TCP socket programming and compile and run it on Linux. But how to compile the source code to windows executable for Windows user clients?
I've tried using
x86_64-w64-mingw32-g++ ...
to compile. But the it fails for not find these files.
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
I know Microsoft provides windows programming APIs, but it will require a lot of adjustment of codes. How to correctly set a cross-compiler to compile it properly for Windows, without having to modify codes?
In theory, C++/C should be a high level language and is not platform-specific.
The solution here doesn't work for me (codes containing TCP sockets). How to compile C code in Linux to run on Windows?