This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc compiler
I assume this is from the book "WinSock 2.0".
If so, you will have to make the following changes
to the includes::
#ifdef WINDOWS
#include <windows.h>
#define SD_BOTH 2
#else
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define SOCKET int
#define SOCKET_ERROR -1
#define SD_RECEIVE 0
#define SD_SEND 1
#define SD_BOTH 2
#define FAR
#define WSAGetLastError() h_errno
#define WSANO_DATA NO_DATA
#define SOCKET int
#define INVALID_SOCKET -1
#define closesocket(s) close((s))
#define strnicmp(a,b,c) strncasecmp((a),(b),(c))
#ifdef SOLARIS
#define INADDR_NONE (in_addr_t) -1
#endif
#endif
You will also have to modify the code as follows:
#ifdef WINDOWS
server_sockaddr.sin_addr = *((LPIN_ADDR) *host_entry->h_addr_list);
#else
#ifdef SOLARIS
server_sockaddr.sin_addr.s_addr = *(unsigned long *) (host_entry->h_addr);
for (i=0; i<8; i++) server_sockaddr.sin_zero[i] = 0;
#else
server_sockaddr.sin_addr.s_addr = host_entry?*(unsigned long
*)(host_entry->h_addr):host.s_addr;
#endif
#endif
(I'm not sure this is exact, since I've modified the code for my own
purposes.
This is excerpted from a book I've written, "Designing Spiders and Robots in
C/C++ (and Perl) for UNIX/Solaris/Linux/Posix and Windows 95/98/NT".)
----- Original Message -----
From: Salari, Morris M <MMSc@pge.com>
To: <help-gcc@gnu.org>
Sent: Thursday, February 22, 2001 8:04 PM
Subject: gcc compiler
> I am trying to compile a C program "http_get.c" with gcc compiler
> on Unix Solaris 2.6, it does not compile and gcc is giving me attaced
> error file. Please help if you could.
> gcc-2.8.1.
> Solaris 2.6.
> Morris Salari
> 415-927-6766 <<gccerror>>
>