getopt with gcc -ansi

Andreas Jaeger aj@suse.de
Wed Aug 11 04:44:00 GMT 2004


Susukita Ryutaro <susukita@postman.riken.go.jp> writes:

> I compiled the following test.c on Redhat 9.
>
> #include <unistd.h>

Read the FAQ:
3.11.	I get some errors with `gcc -ansi'. Isn't glibc ANSI compatible?

> 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?


Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20040811/6f2e71a3/attachment.sig>


More information about the Libc-alpha mailing list