tags:

views:

110

answers:

3

On some of our linux boxen compiling with gcc -std=c99 makes struct ip_mreq dissappear (included from netinet/in.h)

Is there some other interface we are supposed to use ?

A: 

I don't think there's another interface pre-c99. You may be able to use this with -std=c99 if you add the following at the top of your source(s):

#define __EXTENSIONS__

but a better way is probably

#define _XOPEN_SOURCE

Please note that I haven't confirmed.

dwc
A: 

I am having the same problem. Everything compiles fine using gcc when I do not provide "-std=c99", but when the flag is included, the compiler fails saying that the field with type 'struct ip_mreq' "has incomplete type."

This is a problem since I am dependent on some C99 features.

Thanks,

John

Thanks! That did the trick.
+1  A: 

Try --std=gnu99.

The default for GCC is '--std=gnu89' which means C89 with GNU extensions. By selecting '--std=c99' you are enabling C99, but disabling the GNU extensions. '--std=gnu99' will select both C99 and GNU extensions support, giving you the best of both worlds.

bdonlan