A/UX 2.0: "Header File" Problem/Fix

I've encountered a compilation problem recently while porting a program
(tcsh, from OSU) to the A/UX 2.0 environment. The problem seems to be that
some of the system's header files aren't compiling properly. The sample
code below demonstrates the problem I've experienced:

------------------------
/* test file, called tsts.c */

/* these are well-knowns that should work */
#include <sys/errno.h>
#include <stdio.h>

/* these don't work */
#include <sys/stat.h>
#include <sys/times.h>

main()
{

}

Now, take a look at what I did. On the first try, I used the command:

cc tsts.c

Here is the output:

"/usr/include/sys/stat.h", line 48: syntax error
"/usr/include/sys/stat.h", line 48: cannot recover from earlier errors:
goodbye!


On the second try, I used the command:

gcc tsts.c

Here is the output:

In file included from tsts.c:7:
/usr/include/sys/stat.h:48: parse error before `dev_t'
/usr/include/sys/stat.h:54: parse error before `dev_t'

/usr/include/sys/stat.h:64: parse error before `time_t'
In file included from tsts.c:8:
/usr/include/sys/times.h:29: parse error before `time_t'


Is there something amiss? I'm assuming the header files stat.h and times.h are
identical to the header files available to you, so I've not copied them here.


Put the following line before the #include <sys/stat.h> line.  It should
work, because some of the declarations in <sys/stat.h> were defined in
<sys/types.h>.

  #include <sys/types.h>


Published Date: Feb 18, 2012