Mail Archives: djgpp/1997/07/05/11:37:59
Pauli Saksa wrote:
>
> #include <stdio.h>
> void main(short argc)
> {
> printf("argc: %d", argc);
> return;
> }
>
> and here's the compiler's messages:
>
> In function `int main(...)':
> warning: `return' with no value, in function returning non-void
>
> so... could someone tell what I've done wrong?
> I'm new to djgpp so there may be some defaults or something I
> haven't noticed...
Simple. main() is not supposed to return a void value. You are
probably compiling the above code as C++ (by using capital letters on
your command line or some such) and the compiler automatically converts
the return type of main() to an integer and then expects a return at the
end of the function.
Solution: always use the ANSI-correct definition for main().
--
---------------------------------------------------------------------
| John M. Aldrich | "To be 'matter of fact' about the |
| aka Fighteer I | world is to blunder into fantasy-- |
| mailto:fighteer AT cs DOT com | and dull fantasy at that, as the real|
| http://www.cs.com/fighteer | world is strange and wonderful." -LL |
---------------------------------------------------------------------
- Raw text -