Hi,
I am trying to compile the below code using wineg++ compiler in Linux system.
#include <stdio.h>
#include <winsock2.h>
int
main (int argc, char *argv[])
{
char host[50];
gethostname (host, sizeof host);
printf ("host: %s\n", host);
return 0;
}
I get the following error
gethost.cpp: In function ?int main(int, char**)?:
gethost.cpp:9: error: gethostname was not declared in this scope
winegcc: g++ failed
I found that to resolve the clash between winsock2.h and unistd.h patch has been
delivered. As part of this patch gethostname is removed from winsock2.h.
If so please let me know which header to include and which library to link in
order to resolve the above error??
Here I am compiling with -mno-cygwin option so even though I include unistd.h it
will not work. The purpose of using this option is I am using windows runtime
library functions in my code (ex stricmp...).
Please enlighten me!!!!!!!