views:

36

answers:

2

On a quite ancient UNIX (Apple A/UX 3.0.1 for 680x0 processors) using the built-in c compiler (cc), this issue arrises.

Here is the code I'm trying to compile:

#include <stdlib.h>
#include <stdio.h>

int main()
int argc;
char **argv;
{
        if (argc > 1)
            puts(argv[1]);
        return (EXIT_SUCCESS);
}

And here is the output I get:

pigeonz.root # cc -c test.c
"test.c", line 5: declared argument argc is missing
"test.c", line 6: declared argument argv is missing

Using a more modern prototype did not help, nor did the manual page, nor a quick google search. What am I doing wrong?

+2  A: 

For old skool K&R C I think it needs to be:

#include <stdlib.h>
#include <stdio.h>

int main(argc, argv)
int argc;
char **argv;
{
    if (argc > 1)
        puts(argv[1]);
    return (EXIT_SUCCESS);
}
Paul R
Thanks a lot, this fixed it. I was misled by this example: http://www.devx.com/tips/Tip/14356
Fzn
@Fzn: So now I'm curious - why did "using a more modern prototype" not help?
Vicky
A: 

That's an error from Lint (code 53). You can see the source code that throws that error here:

http://www.opensource.apple.com/source/developer_cmds/developer_cmds-49/lint/lint1/decl.c

You could try looking at that code and see if you can work out what leads to that particular code path.

Vicky