Question about "#line"

D. Richard Hipp drh at duke.cs.duke.edu
Thu Oct 18 01:14:35 AEST 1990


When GCC tries to compile the following program:

   #line 40 "../another_dir/xyzzy.c"
   #include "incl.h"

it gives this error:

   ../another_dir/xyzzy.c:40: incl.h: No such file or directory

After some experimentation, I've determined that GCC is trying to include
the file named "../another_dir/incl.h", not "./incl.h" as I want.  In other
words, if I first type:

   ln  incl.h  ../another_dir

then everything will work fine.  PCC does not exhibit this behavior -- it
always looks for the include file in the current directory, regardless of
any "#line" directives.

Which one is correct?  GCC or PCC.  The PCC version makes the most sense
(to me) but I don't know what ANSI says (if it says anything at all.)  Does
anyone else know?



More information about the Comp.lang.c mailing list