注册 登录
编程论坛 Linux教室

gcc -x 命令怎么不起作用了

vfdff 发布于 2011-03-08 00:47, 878 次点击
程序代码:
#include <stdio.h>

int main(void)
{
  char *str="Hello, Gcc Inline Assembly World!n";

  puts(str);

  return 0;
}
对于以上的.c文件,使用 gcc hello1.c -E >& hello1.i得到预处理后的.i文件
然后使用 gcc -x -c hello1.i -x -none -o test 进行编译,提示错误:
gcc: language -c not recognized,这个是为什么?
只有本站会员才能查看附件,请 登录

 
2 回复
#2
pangding2011-03-08 19:22
直接写 -x c 而不是 -x -c 。那个 c 是 x 的一个参数,不是另一个选项,不能加 -。
#3
vfdff2011-03-08 23:40
zyd@HCC:~/projects> gcc hello1.i -g -o test
zyd@HCC:~/projects> ./test
恩,直接输入.i也是可以的
1