I am trying to learn Socket programming on Windows and I am using cygwin for this. I found out that the required files needed for them were /usr/include/w32api/.
I took an example program from the network and tried to compile, but could not do it ... The code for it is
#include <w32api/windows.h>
#include <w32api/winsock.h>
#include <stdio.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
{
WORD sockVersion;
WSADATA wsaData;
int nret;
sockVersion = MAKEWORD(1, 1);
WSAStartup(sockVersion, &wsaData);
}
I compile it with gcc-3 in cygwin and get very strange errors .....
undefined reference to '_WSAStartup08' and many such errors...
I took the code from the training site and, therefore, would like to know what I am doing wrong, and how I should run the program.
Thank you so much.
edit ---------
I also tried using winsock2 instead of winsock.h, but the errors persist ...
user506710
source
share