You can work around this problem by not including <getopt.h> or <unistd.h>. Though, obviously, this is not a long-term solution.
#include <stdio.h>
extern char *optarg;
int main(int argc, char **argv) { int opt; while ((opt = getopt(argc, argv, "avzdrkp:s:o:R:")) != -1) { printf("opt = %d,%c\n", opt, opt); printf("optarg = %s\n", optarg); } }
-----
~$ gcc test.c Info: resolving _optarg by linking to __imp__optarg (auto-import) ~$ ./a -s 1 opt = 115,s optarg = 1 ~$ gcc test.c -liberty ~$ ./a -s 1 opt = 115,s optarg = 1 ~$
Cheers
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/