Hugo Veiga escreveu:
> i'm compiling the following code:
>
>
>
> #include <sys/types.h>
>
> #include <sys/socket.h>
>
> #include <sys/time.h>
>
> #include <netinet/in.h> /* definition of struct sockaddr_in */
>
> #include <netdb.h> /* definition of gethostbyname */
>
> #include <arpa/inet.h> /* definition of inet_ntoa */
>
> #include <unistd.h> /* definition of close */
>
(...)
> and i get the following errors:
>
>
>
> (...)
>
>
>
> In file included from main.cpp:6:
>
> stub.h:5:24: sys/socket.h: No such file or directory
>
> stub.h:7:63: netinet/in.h: No such file or directory
>
> stub.h:8:58: netdb.h: No such file or directory
>
This code won't compile on MinGW; these missing files aren't present on
Win32. You can probably replace them by Winsock (#include <winsock.h>),
but it differs in many details from BSD Sockets - at least for
non-trivial programs.
You have 2 options:
* Learn to use both BSD Sockets and Winsock, and port the code.
* Use Cygwin instead of MinGW, that tries to emulate the BSD Sockets
behaviour.
Daniel K. O.
|