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 Message-ID: <81A52CA9CE040948809DAD901A413C14027E4BF2@seupdms001.dia.eu.pnu.com> From: "Ohgren, Daniel [Non-Employee/0454]" To: "'cygwin AT cygwin DOT com'" Subject: Compiling irda socket code Date: Mon, 24 Feb 2003 08:24:01 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Hello, I've looked for this answer on many forums without luck. I'm trying to compile som code written and compiled on a linux-machine and need to compile it in Cygwin to port it on a microprocessor. I now that Cygwin is _not_ Linux, but as C is an 'international' language it should work...? But i get the following compiling with -traditional flag: $ gcc -traditional irrec.c /usr/include/asm/ioctl.h:56: warning: "_IO" redefined /usr/include/asm/ioctl.h:57: warning: "_IOR" redefined /usr/include/asm/ioctl.h:58: warning: "_IOW" redefined /usr/include/asm/ioctl.h:69: warning: "IOC_IN" redefined /usr/include/asm/ioctl.h:70: warning: "IOC_OUT" redefined /usr/include/asm/ioctls.h:34: warning: "FIONREAD" redefined /usr/include/asm/ioctls.h:41: warning: "FIONBIO" redefined /usr/include/asm/ioctls.h:55: warning: "FIOASYNC" redefined /usr/include/bits/ioctls.h:34: warning: "SIOCGIFCONF" redefined /usr/include/bits/ioctls.h:35: warning: "SIOCGIFFLAGS" redefined /usr/include/bits/ioctls.h:37: warning: "SIOCGIFADDR" redefined /usr/include/bits/ioctls.h:41: warning: "SIOCGIFBRDADDR" redefined /usr/include/bits/ioctls.h:43: warning: "SIOCGIFNETMASK" redefined /usr/include/bits/ioctls.h:45: warning: "SIOCGIFMETRIC" redefined /usr/include/bits/ioctls.h:49: warning: "SIOCGIFMTU" redefined /usr/include/bits/ioctls.h:54: warning: "SIOCGIFHWADDR" redefined /usr/include/bits/confname.h:200: macro or #include recursion too deep /usr/include/sys/features.h:82: warning: "_POSIX_SAVED_IDS" redefined /usr/include/sys/features.h:83: warning: "_POSIX_VERSION" redefined /usr/include/sys/signal.h:168: #error You need the winsup sources or a cygwin in stallation to compile the cygwin version of newlib. irrec.c:36: macro or #include recursion too deep ++++++++++++++++++++++++++++++++++++ I'm speechless, I found some posts about the winsup sources but I didn't quite understand them. I've installed cygwin of the web with _all_ installation options. Please give me some hints... For the ones interested, the code I'm trying to compile is: /* Read an IR socket and display it on stdout */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef AF_IRDA #define AF_IRDA 23 #endif /* AF_IRDA */ unsigned char buf[4098]; int main(int argc, char *argv[]) { struct sockaddr_irda peer, self; int addrlen; int fd, conn_fd; FILE *stream; printf("Creating socket..."); /* Create socket */ fd = socket(AF_IRDA, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); exit(-1); } printf("successful!\n"); /* Initiate receiver */ self.sir_family = AF_IRDA; //Serial IR strncpy(self.sir_name, "MyServer", 25); //Rename to "MyServer" self.sir_lsap_sel = LSAP_ANY; //Select any LSAP: IAS asks secondary which port (LSAP-SEL) /* Bind name "MyServer" to socket fd */ if (bind(fd, (struct sockaddr*) &self, sizeof(struct sockaddr_irda))) { perror("bind"); return -1; } /* Listen if socket fd has more than 8 connections */ if (listen(fd, 8)) { perror("listen"); return -1; } for (;;) { addrlen = sizeof(struct sockaddr_irda); printf("Any connections?\n"); /* Accepting connection if any present and bound, listened. Creates a new socket with same prop. as fd */ conn_fd = accept(fd, (struct sockaddr *) &peer, &addrlen); if (conn_fd < 0) { //Non-negative integer for success (decriptor for accepted socket) perror("accept"); return -1; } stream = fdopen(conn_fd, "r"); //opens and reads conn_fd and streams it to file "stream" if(stream == NULL) { perror("fdopen"); return -1; } printf("Connected!\n"); do { if((fgets(buf, sizeof(buf), stream) == NULL) || (buf[0] == 0x3)) buf[0] = '\0'; fwrite(buf, 1, strlen(buf), stdout); //writes 1 char at the time to stdout from buf until EOF } while (buf[0] != '\0'); fflush(stdout); //forces a write from stdout fclose(stream); //dissociates stream from underlying set of functions printf("\n%d\n",conn_fd); close(conn_fd); //closing file descriptor fd printf("Disconnected!\n"); } return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/