|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: [PLUG] ftw.h frustration
|
Jeff Abrahamson wrote:
> I want to use the function nftw, but it turns out that features.h
> disables this function, even though the files are all GPL.
>
> (Search for __USE_XOPEN_EXTENDED in /usr/include/features.h to see
> details.)
>
> Anyone know why glibc would be compiled without this? Worse, the man
> page doesn't reflect this. It all seems like the sort of thing I'd see
> on a proprietary OS ("Sorry, you didn't pay for that option.") rather
> than on linux.
Looking at /usr/include/features.h, it appears that the purpose is not
to restrict what you have access to, but to give you a choice between
which implementation of a common function you'd like to use ("to specify
the desired environment"). According to the FAQ distributed with libc6:
_GNU_SOURCE: glibc does not make the GNU extensions available
automatically. If a program depends on GNU extensions or some
other non-standard functionality, it is necessary to compile it
with the C compiler option -D_GNU_SOURCE, or better, to put
`#define _GNU_SOURCE' at the beginning of your source files,
before any C library header files are included.
[...]
For more information consult the file `NOTES' in the GNU C
library sources.
And, in the NOTES file:
Macro: _GNU_SOURCE If you define this macro, everything is
included: ISO C89, ISO C99, POSIX.1, POSIX.2, BSD, SVID, X/Open,
LFS, and GNU extensions. In the cases where POSIX.1 conflicts
with BSD, the POSIX definitions take precedence.
So, if you define _GNU_SOURCE, does your program compile as expected?
gabriel rosenkoetter wrote:
> > (Search for __USE_XOPEN_EXTENDED in /usr/include/features.h to see
> > details.)
>
> Why are you including features.h at all?
It's included by /usr/include/ftw.h, and about 150ish other include
files installed by libc6.
-mct
|
|