Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!am.dsir.govt.nz!kahu.marcam.dsir.govt.nz!tony From: tony@kahu.marcam.dsir.govt.nz (Tony Cooper) Newsgroups: comp.unix.aux Subject: Re: rcs/diff, and gcc vs cc (FAQ) Message-ID: <1991Apr20.045608.4744@am.dsir.govt.nz> Date: 20 Apr 91 04:56:08 GMT References: <1991Apr19.151316.26992@athena.mit.edu> Sender: news@am.dsir.govt.nz Reply-To: sramtrc@albert.dsir.govt.nz Organization: Applied Mathematics Group D.S.I.R. Lines: 39 In article <1991Apr19.151316.26992@athena.mit.edu>, sorensen@athena.mit.edu (Alma G. Sorensen) writes: |> I'm trying to get rcs working under 2.0. |> |> However, when I try to compile gnu's diff-1.15, I get errors: |> |> gcc -O -DUSG -DSYSV -c diff.c |> diff.c: In function compare_files: |> diff.c:504: `S_IFDIR' undeclared (first use this function) |> diff.c:504: (Each undeclared identifier is reported only once |> |> Strangely, if I use cc instead of gcc, things compile fine! |> I'm not going to tell you how to fix this problem, but tell how to fix this type of problem. A/UX can compile programs for several different environments - BSD and SYSV. The defines -DUSG and -DSYSV do not work in A/UX for defining the SYSV environment. cc defines the right ones by default, gcc does not. When the right flags are defined then S_IFDIR gets defined, else it doesn't. Read the man page for cc(1) for more information. In general, when a system identifier is not defined, do this: go into the /usr/include directory and do "fgrep -l S_IFDIR *". If that doesn't find it try /usr/include/sys or other directories under /usr/include or do a more sophisticated search of the hierarchy. If you find a .h file that defines S_IFDIR then examine your program and the .h file to see why it is not being defined in the program. Usually it is because the .h file is not included in the program. Sometimes it is because the definition (as in your case probably) has been 'ifdef'ed out eg #ifdef SOME_OTHER_SYMBOL #define S_IFDIR XXXXX #endif Then you should make sure that SOME_OTHER_SYMBOL is defined. Get the idea? You gotta know how the C preprocessor works so you have to have some C programming knowledge. Tony Cooper