invalid use of undefined type `struct fd_set'

Gary Thomas
Sun Oct 18 23:35:00 GMT 1998

On 18-Oct-98 wrote:
>       In trying to build the molecular model viewer rasmol, I believe I have
> found a flaw in egcs 1.1b. When I try to compile the following test case...
> ----------------------------
>#include <sys/select.h>
> int socket;
> static struct fd_set OrigWaitSet;
> main() {
> FD_SET(socket,&OrigWaitSet);
> }                       
> ----------------------------
> ....I get the compiler errors...
> mybug.c: In function `main':
> mybug.c:6: invalid use of undefined type `struct fd_set'
> mybug.c: At top level:
> mybug.c:4: storage size of `OrigWaitSet' isn't known  
> This is on linuxppc running glibc 2.0.98 and linux 2.1.125. It seems to me that
> the compiler is unable to distinguish the lower case declaration of fd_set as a
> struct from the uppercase declaration of FD_SET as a macro. Below are the
> snippets from my sys/select.h with the declarations...
> /* Representation of a set of file descriptors.  */
> typedef __fd_set fd_set;   
> /* Access macros for `fd_set'.  */
>#define FD_SET(fd, fdsetp)      __FD_SET ((fd), (fdsetp))
> Is there a patch in the egcs main tree for this already?

The problem with this (and many other programs) is that Linux does not
define the "struct fd_set", but only the 'typedef ... fd_set".

More information about the Gcc-bugs mailing list