<sys/select.h> depends on <sys/types.h>...?

Charles Swiger cswiger at mac.com
Tue Jan 18 16:00:00 PST 2005


Hi, all--

I was trying to update the BZFlag port, only I've run into a problem 
which can be condensed down to the following minimal test code:

120-ns1% cat foo.cxx
#include <iostream>
#include <sys/select.h>

static int foo = 0;

121-ns1% c++ -c foo.cxx
In file included from /usr/include/sys/select.h:40,
                  from foo.cxx:2:
/usr/include/sys/event.h:53: syntax error before `;'
/usr/include/sys/event.h:55: syntax error before `;'
In file included from foo.cxx:2:
/usr/include/sys/select.h:47: syntax error before `;'

Adding an include for <sys/types.h> works, so I can patch BZFlag to do 
so as well, but I wanted to run this by the peanut gallery and see 
whether this is regarded as a problem with the system headers, or a 
coding error on the part of the developers.

[ This was on a 4.11 system, but the BZFlag code compiles on Linux, 
Solaris, MacOS X, and Win32, so I'm not going to assume that BZFlag is 
doing something wrong, either. ]

-- 
-Chuck

PS: Real error looks like:

gmake[2]: Entering directory 
`/usr/ports/games/bzflag/work/bzflag-2.0.0.20050117/src/bzadmin'
c++ -DHAVE_CONFIG_H -I. -I. -I../../include -I../../src/bzflag 
-I../../include -I/usr/X11R6/include -D_THREAD_SAFE -DBUILDING_BZADMIN 
-O -pipe -march=pentium -DBZ_BUILD_DATE=20050118 -c StdBothUI.cxx
In file included from /usr/include/sys/select.h:40,
                  from StdBothUI.cxx:23:
/usr/include/sys/event.h:53: syntax error before `;'
/usr/include/sys/event.h:55: syntax error before `;'
In file included from StdBothUI.cxx:23:
/usr/include/sys/select.h:47: syntax error before `;'
gmake[2]: *** [StdBothUI.o] Error 1
gmake[2]: Leaving directory 
`/usr/ports/games/bzflag/work/bzflag-2.0.0.20050117/src/bzadmin'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory 
`/usr/ports/games/bzflag/work/bzflag-2.0.0.20050117/src'
gmake: *** [all-recursive] Error 1
*** Error code 2

Stop in /usr/ports/games/bzflag.

140-ns1% head -30 work/bzflag-2.0.0.20050117/src/bzadmin/StdBothUI.cxx
/* bzflag
  * Copyright (c) 1993 - 2005 Tim Riker
  *
  * This package is free software;  you can redistribute it and/or
  * modify it under the terms of the license found in the file
  * named COPYING that should have accompanied this file.
  *
  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */

#ifdef _MSC_VER
#pragma warning( 4: 4786)
#endif
#include <iostream>
#ifdef _WIN32
#include <stdlib.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <wincon.h>
#else
#include <sys/select.h>
#endif

#include "StdBothUI.h"
#include "global.h"

#ifdef _WIN32
unsigned long __stdcall winInput(void *that)



More information about the freebsd-ports mailing list