A/UX cc compiler errors on trivial code: "declared argument argc is missing"
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开发者_StackOverflow社区 google search. What am I doing wrong?
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);
}
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.
精彩评论