ARGC/ARGV strangeness

John Sellens jsellens-Iv5KO+h6AVB+Y12zHexnB0EOCMrvLtNR at public.gmane.org
Tue Sep 20 03:05:27 UTC 2005


| I thought I had understood argc/argv under GNU C, but I guess this 
| problem has me stumped.

One thing that's usually a very useful argument on the gcc command
line is -Wall.  (Put it in your Makefiles.)

On my system,
    % gcc -Wall a.c
    a.c: In function `main':
    a.c:9: warning: implicit declaration of function `strtol'
which would lead you to the strtol man page, and the need to
    #include <stdlib.h>
which would then tell you
    % gcc -Wall a.c
    a.c: In function `main':
    a.c:10: too few arguments to function `strtol'
which likely would have found the bulk of your problem.

Cheers

John
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list