A/UX cc 编译器在简单代码上出现错误:“声明的参数 argc 丢失”

发布于 2024-08-31 17:26:52 字数 521 浏览 5 评论 0原文

在使用内置 c 编译器 (cc) 的相当古老的 UNIX(用于 680x0 处理器的 Apple A/UX 3.0.1)上,会出现此问题。

这是我试图编译的代码:

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

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

这是我得到的输出:

pigeonz.root # cc -c test.c
"test.c", line 5: declared argument argc is missing
"test.c", line 6: declared argument argv 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 google search. What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清风无影 2024-09-07 17:26:52

对于old skool,K&RCI 认为它需要是:

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

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

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);
}
眼眸里的快感 2024-09-07 17:26:52

这是来自 Lint 的错误(代码 53)。您可以在此处查看引发该错误的源代码:

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

您可以尝试查看该代码,看看是否可以找出导致的结果该特定的代码路径。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文