[uClibc]Weird inclusion of getopt.h

Thierry Laronde thierry at cri74.org
Wed Jun 13 15:27:25 UTC 2001


Hello,

Compiling a very same file both against glibc and uclibc, the compilation
fails because of the warning about a redefinition of the struct option.

Tracing down the preprocessor inclusions, I finally found that the "cause"
is the definition of __USE_POSIX2 in "features.h", leading to the inclusion
of "getopt.h" via "unistd.h", while in glibc this
definition is protected via :

#undef __USE_POSIX2

#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
# define __USE_POSIX2   1
#endif

I have solved my problem by passing -D_GETOPT_H to the wrapper, but I don't
know if this is something that might be harmful for others.

Cheers,
-- 
Thierry LARONDE, Centre de Ressources Informatiques, Archamps - France
http://www.cri74.org/





More information about the uClibc mailing list