getopt with gcc -ansi

Susukita Ryutaro susukita@postman.riken.go.jp
Wed Aug 11 03:42:00 GMT 2004


I compiled the following test.c on Redhat 9.

#include <unistd.h>

int main(int argc, char **argv){
  getopt(argc, argv, "a");
  return 0;
}

$ gcc -Wall test.c
$ gcc -Wall -ansi test.c
test_getopt.c: In function `main':
test_getopt.c:4: warning: implicit declaration of function `getopt'

Why the declaration of getopt is not effective when I compile with
-ansi?  Could I use getopt with -ansi?

susukita



More information about the Libc-alpha mailing list