Path: utzoo!attcan!uunet!timbuk!cs.umn.edu!ub.d.umn.edu!rutgers!ucsd!ucbvax!hplabs!hpfcso!mev From: mev@hpfcso.HP.COM (Mike Vermeulen) Newsgroups: comp.sys.hp Subject: Re: Compiling problems with gcc Message-ID: <7370236@hpfcso.HP.COM> Date: 20 Oct 90 01:34:08 GMT References: Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 36 > However, at some magical point in the hpux C compiler, there are a > couple of #define's made, which I can't track down: > _INCLUDE_POSIX_SOURCE > _INCLUDE_XOPEN_SOURCE > _INCLUDE_HPUX_SOURCE > I can't find these in /lib/cpp, cc or any of the similar type places. > But if the XOPEN define is not made, then such types as caddr_t are > not defined by . Hence compiling an X program gets > awkward. The magical point where these are set is . Each of the symbols above controls the set of names for a particular namespace. The way these work is: - In a strict ANSI C compile, the header files must not "pollute" the namespace with extra symbols (e.g. a user can create their own variable named caddr_t without conflict from the headers). Thus if only __STDC__ is defined then the namespace is completely clean an no extra symbols are defined. - Users of the XOPEN and POSIX know about symbols "_POSIX_SOURCE" and "_XOPEN_SOURCE" that must be defined to get compiles that correspond to those standards. - To get a "dirty" namespace, define the symbol _HPUX_SOURCE with either a -D_HPUX_SOURCE or #define _HPUX_SOURCE. I think in your case, you want to do the last, i.e. add a -D_POSIX_SOURCE to the arguments passed to cpp. > Compiling with all of them set seems to fix all the problems, but it's > a hassle to constantly have to fiddle with the Makefile's. The correct way is to set the symbol _HPUX_SOURCE, not the individual defines. --mev DISCLAIMER: This is not an official HP response.