From: khan AT xraylith DOT wisc DOT edu (Mumit Khan) Subject: Re: mingw32 13 Jan 1998 17:50:52 -0800 Message-ID: <9801130112.AA12306.cygnus.gnu-win32@modi.xraylith.wisc.edu> References: <3 DOT 0 DOT 1 DOT 32 DOT 19980111002624 DOT 00953b90 AT popd DOT ix DOT netcom DOT com> To: Narayan Natarajan Cc: gnu-win32 AT cygnus DOT com Narayan Natarajan writes: > Does mingw32 have getopt in its libraries? I am having trouble compiling > code using getopt with mingw32. yes, and no. The GNU getopt (as well as getopt_long) is part of the libiberty library, which should have been in the distribution (see the /lib directory), unless I missed it somehow. Unfortunately, the getopt.h is not installed by default, which provides the prototypes and some of the definitions needed for getopt_long. Let me know if you can't find it in some other GNU package and I'll email it to you. fyi, getopt is not ANSI, hence not guaranteed to be in an ANSI-only runtime; it is however in the POSIX.1 specs, so most real systems provide it. My own code uses getopt that is built along with the package, so it's not an issue (and that's why I didn't miss the missing getopt prototype). As a quick hack: extern int getopt(int argc, char * const argv[], const char *optstring); extern char *optarg; extern int optind, opterr, optopt; int main (int argc, char *argv[]) { /* use getopt */ } Now link -liberty as well. % cc -o getopt_test.exe getopt_test.c -liberty. and see what happens. Mumit - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".