From: kellyj AT ricochet DOT net (J. Kelly Johnson) Subject: Undefined reference to cygwin32_inet_aton in b18. 7 Dec 1997 17:53:33 -0800 Message-ID: <348B4D2A.4C561932.cygnus.gnu-win32@ricochet.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------21265BA4B8507776D5D8E17F" To: gnu-win32 AT cygnus DOT com This is a multi-part message in MIME format. --------------21265BA4B8507776D5D8E17F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I have a small program which needs to use the inet_aton function. When compiled with gcc under b18 (the code includes the arpa/inet.h header), I get the message: undefined reference to 'cygwin32_inet_aton' gcc: Internal compiler error: program ld got fatal signal 1 I use the opposite function in my code (inet_ntoa) with no difficulties. Am I missing something here? Or is the header file incorrect (or the libraries missing a function)? I have attached a short test program which exhibits the problem. Any help would be appreciated, Kelly Johnson --------------21265BA4B8507776D5D8E17F Content-Type: text/plain; charset=us-ascii; name="aton.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="aton.c" /*********************************************************************/ /* */ /* This routine retrieves the document associated with the URL */ /* specified as the first parameter. */ /* */ /* Written under contract by: */ /* J. Kelly Johnson */ /* Large Systems Specialists */ /* */ /*********************************************************************/ /*********************************************************************/ /* */ /* Defines/includes. */ /* */ /*********************************************************************/ #include #include #include #include #include #include #include /* Socket fns (bind, connect, etc.) */ #include /* Addr defs and net order fns (htons, etc.)*/ #include /* Inet addr fns (inet_aton, inet_ntoa) */ #include /* Network database fns (gethostbyname) */ #include #define MAX_LINE 10000 #define MAX_WAIT 360 /* Max wait for server response (seconds).*/ /*********************************************************************/ /* */ /* Structures. */ /* */ /*********************************************************************/ struct list_entry { /* Event tree node structure. */ struct list_entry *left; struct list_entry *right; void *data; char key[1]; }; typedef struct list_entry list_node; /*********************************************************************/ /* */ /* Function prototypes. */ /* */ /*********************************************************************/ static int error(int return_code, char *error_message); FILE *get_response_stream(char *header, FILE *request_stream, struct sockaddr_in *server_socket_addr, int *rc_parm, char **msg_parm); FILE *get_response_stream_error(int return_code, char *error_message, int *rc_parm, char **msg_parm); /*********************************************************************/ /* */ /* Exported routine. */ /* */ /*********************************************************************/ main(int argc, char **argv) { char message[1000]; /* Message buffer. */ char *program_name; /* Executable name of this prog. */ char *server_name_parm; /* Serv name specified (or NULL). */ struct in_addr ip_addr; /* Network form of IP address. */ struct hostent *server_host_entry;/* Info from gethostbyname. */ int server_port; /* Target port on server. */ char *source_file_parm; /* Source file name parameter. */ FILE *source_file_stream; /* Source file stream. */ int parm_error; /* Flag indicating parm error. */ struct in_addr *server_in_addr; /* Server internet address. */ struct sockaddr_in server_socket_addr; /* Server socket address. */ FILE *response_stream; /* Server response stream. */ int return_code; /* Result code from function call.*/ char *error_message; /* Error message from fn call. */ char buffer[20000]; /* Read/write buffer. */ int bytes_written; /* No. of bytes written to socket.*/ int bytes_read; /* No. of bytes read from socket. */ /*******************************************************************/ /* */ /* Validate the parameters. */ /* */ /*******************************************************************/ program_name = *argv; server_name_parm = NULL; server_port = 80; parm_error = 0; while (!parm_error && *++argv) { if (!strcmp(*argv, "-s")) { /***************************************************************/ /* */ /* Found a web server name specifier. */ /* */ /***************************************************************/ if (!(server_name_parm = *++argv)) parm_error = 1; else if (inet_aton(server_name_parm, &ip_addr) && (server_host_entry = gethostbyaddr((char *) &ip_addr, sizeof(struct in_addr), AF_INET))); else if (!(server_host_entry = gethostbyname(server_name_parm))) { sprintf(message, "Cannot resolve server name \"%s\".", server_name_parm); return error(4, message); } } else if (**argv == '-') /***************************************************************/ /* */ /* Found an unknown option. */ /* */ /***************************************************************/ parm_error = 1; else if (source_file_parm) /***************************************************************/ /* */ /* Found an extraneous parameter. */ /* */ /***************************************************************/ parm_error = 1; else { /***************************************************************/ /* */ /* Found the source file to send. */ /* */ /***************************************************************/ source_file_parm = *argv; if (!(source_file_stream = fopen(source_file_parm, "r"))) { sprintf(message, "Error opening source file \"%s\".", source_file_parm); return error(8, message); } } } if (parm_error || !source_file_parm) { sprintf(message, "\nUsage: %s [-s target_server] source_file\n\n" "Author: J. Kelly Johnson, (408) 223-1327\n" "Copyright: LSS 1996 - all rights reserved.", program_name); return error(16, message); } return 0; } /*********************************************************************/ /* */ /* Error routine. Output passed error message and return the */ /* specified return code as a result. */ /* */ /*********************************************************************/ static int error(int return_code, char *error_message) { fprintf(stderr, "%s\n", error_message); return return_code; } --------------21265BA4B8507776D5D8E17F-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".