I have compiled the gnu standard library and installed it in $GLIBC_INST
.
Now, I try to compile a very simple programm (using only one #include
That's because files under /usr/include
are common headers that provided by the C library, for example, glibc
, while the files at /usr/lib/gcc
are specific for that particular compiler. It is common that each compiler has their own different implementation of stddef.h
, but they will use the same stdio.h
when links to the installed C library.
Why is that file not under
/usr/include
?
Because there's absolutely no requirement for standard headers to be located at /usr/include/
.
The implementation could place them anywhere. The only guarantee is
that when you do #include <stddef.h>
, the compiler/preprocessor correctly locates and includes it. Since you disable that with -nostdinc
option of gcc, you are on your own (to correctly give the location of that header).
When you say #include <stddef.h>
it does not require that /usr/include/stddef.h
exists as a file on disk at all. All that is required of an implementation is that #include <stddef.h>
works, and that it gives you the features that header is meant to give you.
In your case, the implementation put some of its files in another search path. That's pretty typical.