Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* cpp bug?
@ 1995-03-14 18:20 James Bonfield
  1995-03-16 17:44 ` Dan Pop
  0 siblings, 1 reply; 2+ messages in thread
From: James Bonfield @ 1995-03-14 18:20 UTC (permalink / raw)


I would be appreciate it no end if anyone has any hints on solving the
following problem.

I have a C file called (eg) /X/prog.c that includes "inc.h".
Now there's an "inc.h" in my current directory (which is not /X) and also in
the /X directory. My current "inc.h" is a different version than the one in
/X. Now the question is how do I compile prog.c to include my own inc.h? inc.h
is included using "inc.h" rather than <inc.h>.

The most natural thing is:

cc -I. -c /X/prog.c -o prog.o

However this includes /X/inc.h still. So I then tried disabling the standard
include path and explicitly setting things:

cc -I -I/usr/include -I`pwd` /X/prog.c -o prog.o

Nope - it still picks up /X/inc.h. I've tried c89 and cc -migrate too. This is
getting _REALLY_ annoying. I finally figured that 'gcc -I. -I-' works, but I'd
rather use cc than gcc (as it means recompiling gcc to bring myself vaguely up
to date).

Do I need to use <inc.h> instead of "inc.h"? This will be a real pain if so as
we're actually talking about in excess of 300 include files that are doubtless
included many more times.

It seems to be a bug of the cpp to me that it is impossible to override the
explicit search of the local directory when looking for include files. Is
there any solution to this other than copying (or symlinking) over all the
source from /X to .? Seems a bit drastic and annoying.

Incase you're wondering, the situation where this occurs for us is when
keeping a main repository of source and object files and then making local
changes by copying the relevant source files and recompiling. It's all too
frequent that the wrong include file gets picked up and some subtle bug creeps
in.

	James
-- 
James Bonfield (jkb@mrc-lmb.cam.ac.uk)   Tel: 01223 402266   Fax: 01223 412282
Medical Research Council - Laboratory of Molecular Biology,
Hills Road, Cambridge, CB2 2QH, England.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-03-16 17:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-03-14 18:20 cpp bug? James Bonfield
1995-03-16 17:44 ` Dan Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox