Sujet : Re: What are GCC's "Standard system directories" on GNU/Linux?
De : acm (at) *nospam* muc.de (Alan Mackenzie)
Groupes : comp.lang.cDate : 05. Feb 2025, 14:58:33
Autres entêtes
Organisation : muc.de e.V.
Message-ID : <vnvqq9$2qqi$2@news.muc.de>
References : 1 2
User-Agent : tin/2.6.4-20241224 ("Helmsdale") (FreeBSD/14.2-RELEASE-p1 (amd64))
Hello, Dan.
Dan Purgert <
dan@djph.net> wrote:
On 2025-02-05, Alan Mackenzie wrote:
In the GCC manual, section 3.16 "Options for Directory Search" partially
describes where, how, and in what order GCC finds #include files when
compiling.
>
It's the "partially" bit which is getting on my nerves. The manual
section contains a priority list for finding #include files, but the
fifth item just vaguely states:
>
5. Standard system directories are scanned.
>
. Which directories are these? Where is this documented?
It is, as I recall, defined at compile time of gcc. You can get your
system-specific "standard system directories" by running the command:
echo | gcc -xc -E -v -
It'll print out a bunch of stuff, starting off with the compile-time
options that were used when compiling gcc itself. The bit you're
looking for being listed out under the heading:
#include <...> search starts here:
HTH
Thank you indeed! That was extremely helpful, and told me everything I
need to know.
I'm creating my own version of the linux kernel, and have several
application programs to build that must #include files from this version
rather than the standard ones.
The listing from the command you gave me tells me that <linux/kd.h> will
be read from /usr/include/linux/kd.h, and so on. Now I know that, I can
amend the Makefiles.
--
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860
-- Alan Mackenzie (Nuremberg, Germany).