Note that there are some explanatory texts on larger screens.

plurals
  1. POCygwin gcc compiling error
    primarykey
    data
    text
    <p>I was trying to compile a C socket program in CYGWIN gcc but when I compile the client program it gives me the following error</p> <pre><code>client.h: In function ‘error’: client.h:11:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default] exit(1); ^ client.h: In function ‘main’: client.h:30:9: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default] exit(0); ^ client.h:36:5: warning: passing argument 2 of ‘connect’ from incompatible pointer type [enabled by default] if(connect(sockfd,&amp;serv_addr,sizeof(serv_addr)) &lt; 0) ^ In file included from client.h:3:0: /usr/include/sys/socket.h:28:7: note: expected ‘const struct sockaddr *’ but argument is of type ‘struct sockaddr_in *’ int connect (int, const struct sockaddr *, socklen_t); ^ </code></pre> <p>And when I tries to compile the server program it gives me the following error</p> <pre><code>server.h: In function ‘error’: server.h:8:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default] exit(1); ^ server.h: In function ‘main’: server.h:18:9: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default] exit(1); ^ server.h:23:5: warning: incompatible implicit declaration of built-in function ‘bzero’ [enabled by default] bzero((char *) &amp;serv_addr, sizeof(serv_addr)); ^ server.h:32:64: error: ‘client’ undeclared (first use in this function) newsockfd = accept(sockfd, (struct sockaddr *) &amp;cli_addr, &amp;client); ^ server.h:32:64: note: each undeclared identifier is reported only once for each function it appears in </code></pre> <p>So what is the solution to this</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload