[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to force location of headers
From: |
Russ Allbery |
Subject: |
Re: How to force location of headers |
Date: |
Sat, 14 Apr 2012 13:39:04 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
"James K. Lowden" <address@hidden> writes:
> Russ Allbery <address@hidden> wrote:
>> "" is primarily a source of bugs and annoyances
> Based on what?
Problems just like the one on this thread, or the breakage Debian saw with
multiarch and headers that relied on "", or similar problems that we've
seen over the years with software using -I- to try to work around problems
with "". I've also seen it cause problems with non-recursive make and
with VPATH builds with different compilers that disagreed over what the
local directory is for "" in different situations.
See also the Autoconf manual advice for the config.h header, which gives
yet another reason:
To provide for VPATH builds, remember to pass the C compiler a
`-I.' option (or `-I..'; whichever directory contains `config.h').
Even if you use `#include "config.h"', the preprocessor searches only
the directory of the currently read file, i.e., the source directory,
not the build directory.
With the appropriate `-I' option, you can use `#include
<config.h>'. Actually, it's a good habit to use it, because in the
rare case when the source directory contains another `config.h', the
build directory should be searched first.
and indeed it was that advice that pushed me towards getting rid of "" in
my projects many years ago.
--
Russ Allbery (address@hidden) <http://www.eyrie.org/~eagle/>