[comp.sys.ncr] header file problems

rfadler@uswnvg.UUCP (Richard Fadler) (04/11/91)

I have run across a problem and was wondering if it sounded familiar to anyone. 
I have a Tower 450 running UnixV.3 version 030001 with the appropriate 
development and extension modules. We use the Tower to port software that is
developed on a Sequent to NCR's version of unix.  Because we have the source
on another machine we don't make backups of our Tower.

We recently had the disk drive go bad on it and had the drive replaced.
Restoring our code was no problem once we reloaded to OS from the original
tapes.  Once we began compiling the problem appeared.

In code that previously compiled with no problem I began seeing an error
where an include statement that includes <sys/types.h> causes an error
stating that on line 12 of /usr/include/sys/types.h there is a syntax
error.  It turns out that one of our own header files also includes
/sys/types.h and if either one of the lines is commented out it compiles
fine.

At this point your probably thinking "so whats the problem"?!?! I thought it
was solved at this point to until I removed the offending line then tried 
recompiling our code on the other systems we support.  Our own header file
doesn't just include sys/types.h, it uses ifdef to determin if it should.
Because all the unix vendors do such a swell job of making their header
files and libraries look identical we have to keep the conditional inclusion
of sys/types.h in our header and the inclusion of sys/types.h in our
code. :-) 

I have built a test program that consists of:
#include "homemade.h"
#include <sys/types.h>
#include <sys/stat.h>
main()
{
}

Where homemade.h includes sys/types.h.

This compiles just fine our NCR 3000 running SysV.4, a Sequent running ptx,
and a Pyramid running osx, but not on the Tower.  Before the disk crashed it
compiled just fine on the Tower, unfortunately the Tower was configured long
before I started working here and I really didn't get involved with it until
the disk crashed. Consequently I don't know if any patches had been applied 
that were not on the OS tapes I used to restore the system.

Does anyone have any ideas, besides making backups?!

Thanks in advance

Rick

harris@sauron.Columbia.NCR.COM (Ray Harris) (04/12/91)

In article <727@uswnvg.UUCP> rfadler@uswnvg.UUCP (Richard Fadler) writes:
->I have a Tower 450 running UnixV.3 version 030001 with the appropriate 
[....]
->In code that previously compiled with no problem I began seeing an error
->where an include statement that includes <sys/types.h> causes an error
->stating that on line 12 of /usr/include/sys/types.h there is a syntax
->error.  It turns out that one of our own header files also includes
->/sys/types.h and if either one of the lines is commented out it compiles
->fine.
[....]
->This compiles just fine our NCR 3000 running SysV.4, a Sequent running ptx,
->and a Pyramid running osx, but not on the Tower.  Before the disk crashed it

The V.4 header files on the System 3000 use the following construct:

#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H

Body of header file here

#endif  /* _SYS_TYPES_H */

This allows you to include the same include file more than once without
the problem you're encountering.
-- 

Ray.Harris@ncrcae.Columbia.NCR.COM (Ray Harris)    
..!uunet!ncrlnk!ncrcae!harris		...!gatech!hubcap!ncrcae!harris