gcc 4.3.2 accept sys call warrning incompatible pointer type


 
Thread Tools Search this Thread
Top Forums Programming gcc 4.3.2 accept sys call warrning incompatible pointer type
# 1  
Old 04-20-2009
gcc 4.3.2 accept sys call warrning incompatible pointer type

Hi all, this warning is driving me nuts. I use -pedantic with -Wall and -Werror so this needs to be fixed.
BUILD: GNU-Linux-x86

Any ideas?

struct sockaddr_in server_addr;
int addr_len = sizeof (server_addr);

fd = accept(link->socket_fd,
(struct sockaddr_in *) &server_addr,
(socklen_t *) &addr_len));

warning: passing argument 2 of ‘accept' from incompatible pointer type

Thanks for you comments.
# 2  
Old 04-20-2009
Try casting with "(struct sockaddr *)"
# 3  
Old 04-21-2009
ahh, thanks.
Thats weird that it would be different that the initializer.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Incompatible data type fpos_t in C

This is from a program I wrote over in 1998 that I am trying to compile on a linux machine: void write_line (FILE *fp, int rec_no, line_rec *arec) { fpos_t woffset; woffset = (rec_no - 1) * sizeof(line_rec); fsetpos(fp,&woffset); fwrite(arec,sizeof(line_rec),1,fp); }On the line... (2 Replies)
Discussion started by: wbport
2 Replies

2. Programming

Warning: pointer type mismatch

Hi all, I'm new programming in C, so I had the next message in my code: Dual.c:88:20: warning: pointer type mismatch in conditional expression : &clientSa.sin6.sin6.sin6_addr, Any help would be great #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include... (1 Reply)
Discussion started by: godna
1 Replies

3. Red Hat

Incompatible Level of gcc?

I'm compiling an application someone gave me. It uses XLC on a Power7, running Red Hat (4? 5?). It compiles and links, but I get the following message for every .o and .exe... xlc_r: 1501-274 (W) An incompatible level of gcc has been specified. I've tried googling on this error, and I'll I... (2 Replies)
Discussion started by: Harper21
2 Replies

4. Programming

Compilation Error: dereferencing pointer to incomplete type

I am getting a dereferencing pointer to incomplete type error when i compile the following code on lines highlighted in red. Can anyone help me in identifying what is wrong in the code? #include<stdio.h> #include<stdlib.h> typedef struct{ int info; struct node* link ; } node; void... (3 Replies)
Discussion started by: sreeharshasn
3 Replies

5. Programming

GCC - Incompatible Pointer Types

Hi guys, here is my code written in C and the compiler error message. int i; int (*a); for (i = 1;i <= 9;i++) a = (int *)malloc(sizeof(int) * 10);here is the error: incompatible types when assigning to type ‘int’ from type ‘int *’I want to make a two dimensional array. I... (2 Replies)
Discussion started by: majid.merkava
2 Replies

6. Programming

Dereferencing pointer to incomplete type

// Hello all, I am having this error "Dereferencing pointer to incomplete type " on these 2 lines: xpoint = my_point->x; ypoint = my_point->y; I am having no clue y this is happening. Any help would be greately appreciated!!!! #include<stdio.h> #include<string.h>... (2 Replies)
Discussion started by: mind@work
2 Replies

7. UNIX for Dummies Questions & Answers

Why do I need to call make if I call gcc ?

Why do I need to call make if I call gcc ? I thought gcc already compiles the sources. thanks (1 Reply)
Discussion started by: aneuryzma
1 Replies

8. Programming

enable 64bit long type for gcc

hey, I believe I once saw a post in this forum, about enable an GCC option to enable long types. I simply cannot find it any more. Can anybody give me a hint? I am on 32bit Ubuntu, and I would like my int be really long. Also I need malloc() take long int argument too. I found it is necessary to... (6 Replies)
Discussion started by: patiobarbecue
6 Replies

9. Programming

Accesing structure member:Error:dereferencing pointer to incomplete type

$ gcc -Wall -Werror struct.c struct.c: In function `main': struct.c:18: error: dereferencing pointer to incomplete type $ cat struct.c #include <stdio.h> #include <stdlib.h> #include <string.h> /*Declaration of structure*/ struct human { char *first; char gender; int age; } man,... (3 Replies)
Discussion started by: amit4g
3 Replies

10. Programming

adv reqd on SIGCHLD on accept call

Hi, I have small problem. In my (concurrent)server programm, I am handling accept problem from client like this. sample of server code. /*******************/ end = 0; while (! end ) { sockfd = accept(...) if(sockfd == -1) { if (errno == EINTR) /* this is bcoz... (5 Replies)
Discussion started by: stevenjagan
5 Replies
Login or Register to Ask a Question