1

我在 64 位 Redhat Enterprise 3 机器上编译了 gcc 4.5.2(2.4.21-20.ELsmp,glibc 2.3.2)。它编译正常,但有很多警告消息,如

/tmp/ccbGRF5F.s: Assembler messages:
/tmp/ccbGRF5F.s:29: Warning: rest of line ignored; first ignored character is `d'
/tmp/ccbGRF5F.s:33: Warning: rest of line ignored; first ignored character is `d'
/tmp/ccbGRF5F.s:169: Warning: rest of line ignored; first ignored character is `i'

然后我尝试用编译器编译代码,它仍然会吐出这些 asm 警告,而且我没有在我的 C 代码中使用任何 asm。我怎样才能摆脱它?修复或抑制警告都很好。

4

2 回答 2

4

看来您的 binutils 太旧了,无法处理 gcc-4.5 的输出 - 在另一个项目中,它可能会以编译失败而彻底结束。鉴于 RHEL3,这根本不会让我感到惊讶。

于 2011-03-18T00:46:20.053 回答
0

我假设您正在使用命令行进行编译?在编译命令中添加“-w”标志将禁止所有警告。例如,要在没有警告的情况下编译 hello.c:

 gcc hello.c -w -o hello 

将产生输出文件“hello”,不会吐出任何错误。

于 2011-03-17T22:43:18.310 回答