Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 16 Jun 2005 22:59:22 -0400 From: "Fernando Barsoba" Subject: inet_pton() error. Does Cygwin support inet_pton()? To: Message-id: <00a401c572e8$90d2f250$0302a8c0@SERVER> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original Content-transfer-encoding: 7bit Hello all, I'm trying to use the function inet_pton(), but I found the following error when trying to build the application with Eclipse/CDT on Cygwin: (I apologize in advance if this is not a Cygwin related problem. It's simply that I saw a post in which it was mentioned that inet_pton() wasn't supported by Cygwin...) ERROR: make -k clean all rm -f newclient.o newserver.o test.o gcc -c -o newclient.o newclient.c gcc newclient.c -o newclient /cygdrive/f/DOCUME~1/FERNAN~1/LOCALS~1/Temp/ccqoLn6M.o(.text+0xae):newclient.c: undefined reference to `_inet_pton' collect2: ld returned 1 exit status make: *** [newclient] Error 1 gcc -c -o newserver.o newserver.c gcc newserver.c -o newserver gcc -c -o test.o test.c gcc test.c -o test make: Target `all' not remade because of errors. As you can see, it seems that the library is misson or something.., but I did include it.. CODE: #include #include #include // inet_pton() reference...? #include #include #include int main(int argc, char **argv) { int sockfd; // socket file descriptor struct sockaddr_in servaddr; // IPv4 socket address structure //sockfd = socket(AF_INET, SOCK_STREAM, 0); // call to socket function printf("Connecting to socket..."); if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) printf("Socket Error"); bzero((char *) &servaddr, sizeof(servaddr)); // initialization of socket structure to 0 servaddr.sin_family = AF_INET; servaddr.sin_port = htons(/*9877*/13); // Port in host byte order must be converted // to network byte order if (inet_pton(AF_INET, argv[1], &servaddr.sin_addr) <= 0) printf("\ninet_pton error"); if (connect(sockfd,( struct sockaddr *) &servaddr, sizeof(servaddr)) < 0) printf("\nError connecting to server!"); // Connection to port 9877, IP? exit(0); } Any idea? Thanks, FBM -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/