Path: utzoo!utgpu!watserv1!watmath!att!rutgers!sun-barr!apple!uokmax!servalan!rmtodd From: rmtodd@servalan.uucp (Richard Todd) Newsgroups: comp.unix.aux Subject: Re: include file syntax errors? Message-ID: <1990Oct17.235219.10101@servalan.uucp> Date: 17 Oct 90 23:52:19 GMT References: <22427@fs2.NISC.SRI.COM> Organization: Ministry of Silly Walks Lines: 33 cwilson@NISC.SRI.COM (Chan Wilson [Animal]) writes: >I'm trying to port some fairly tame programs we've developed here, and >keep running into a include file syntax errors! There's more than >one; /usr/include/utmp.h springs to mind, but I seen to recall file.h >having problems also. Nope, this isn't a syntax error in the include file, it's an error in your program. Let's take a look at what happens when I try to compile the sample program you posted: 21 servalan /tmp[6:43pm] % cat >foo.c #include main() {} 22 servalan /tmp[6:43pm] % gcc foo.c In file included from foo.c:1: /usr/include/utmp.h:40: parse error before `time_t' Looking at utmp.h, one notes that the file uses a typedef'd type, time_t, but does not have the definition for time_t. The definition for that, along with a lot of other special types, is found in /usr/include/sys/types.h. Thus one should #include before #include-ing , viz.: 26 servalan /tmp[6:49pm] % cat >foo.c #include #include main() {} 27 servalan /tmp[6:50pm] % gcc foo.c 28 servalan /tmp[6:50pm] % Look, Ma, no errors. -- Richard Todd rmtodd@uokmax.ecn.uoknor.edu rmtodd@chinet.chi.il.us rmtodd@servalan.uucp Motorola Skates On Intel's Head!