在 AIX 上编译 netcat
我尝试在 AIX 上编译 netcat.c 一段时间了(使用命令 make aix
),但编译器给了我一些奇怪的反馈,例如:
“netcat.c”,第 117.12 行:1506 -275 (S) 遇到意外的文本“int”。
当检查文件 netcat.c 的第 117 行时,我会找到该行(下面代码中的第二行):
#ifdef HAVE_BIND
extern int h_errno;
/* stolen almost wholesale from bsd herror.c */
即使我将 int 更改为 char 进行相同的测试,保存文件并重新运行命令我得到同样的错误,
我在读取错误代码时遗漏了一些东西吗?
I have been trying to compile netcat.c on AIX for some time (using the command make aix
), but the compiler gives me some weird feedback such as :
"netcat.c", line 117.12: 1506-275 (S) Unexpected text 'int' encountered.
when checked the file netcat.c at line 117, I would find the line (second line in code below):
#ifdef HAVE_BIND
extern int h_errno;
/* stolen almost wholesale from bsd herror.c */
even if I changed the int into char for the same of testing, save the file and re-run the command I get the same error
am I missing something in reading the error code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用的是 xlc(尤其是较旧的),它通常是由语句后的声明引起的,例如:
您可能需要给我们更多的上下文,例如错误之前的 10 行左右线。
如果您使用较旧的 xlc,我的建议是在该机器上运行
gcc
。 IBM 现在制作了一些优秀的编译器,但早期的编译器并没有那么热门(在我看来)。If you're using
xlc
(especially older ones), it's normally caused by declarations after statements, something like:You probably need to give us a little more context, such as 10 or so lines before the error line.
My advice would be to get
gcc
running on that box if you are using an older xlc. IBM makes some fine compilers now but the earlier ones weren't so crash hot (in my opinion).当看似无害的代码产生奇怪的错误时,请尝试通过 C 预处理器阶段运行代码,然后查看它。有时宏会做一些非常有趣的事情。
另请注意,前一行的问题(缺少分号等)可能会在后一行产生错误消息。
When innocent-looking code produces bizarre errors, try running the code through the C preprocessor stage, and looking at it then. Sometimes macros do very funny things.
Also note that a problem on an earlier line (missing semicolon, etc.) might produce an error message on a later line.
这篇文章可能已经有点过时了,但以防万一其他人遇到同样的问题......
这里(AIX 7.1)h_errno 被定义为 netdb.h 中的宏。
因此netcat.c第117行中的声明不起作用。
我刚刚将行更改为
,编译工作顺利。
The post maybe already a little outdated, but just in case someone else comes along with the same problem ...
Here (AIX 7.1) h_errno is defined as macro in netdb.h.
Therefore the declaration in netcat.c line 117 does not work.
I just changed the line into
and the compilation worked smoothly.
@A.Rashad,我将 HAVE_BIND #ifdef 块从第 117 行移至第 30 行,该行位于 #include "generic.h" 声明下方。这允许 xlc 对其进行编译。 (S) 语法错误消息消失了,虽然有一些 (W) 警告消息,但我最后得到了一个 nc 二进制文件!
哈,
凯文
@A.Rashad, I moved the HAVE_BIND #ifdef block from line 117 to line 30 which is just under the #include "generic.h" declaration. This permitted the xlc to compile it. The (S)yntax error messages are gone and while there are some (W)arning messages, I do get an nc binary at the end!
hth,
Kevin