gcc编译报错如下:
hello.s: 警告: 文件结束,非行尾;插入新行
hello.s:1: 错误: junk at end of line, first unrecognized character valued 0x7f
hello.s:1: 错误: junk at end of line, first unrecognized character valued 0x3
hello.s:1: 错误: junk at end of line, first unrecognized character is >' hello.s:1: 错误: junk at end of line, first unrecognized character valued 0x1 hello.s:1: 错误: junk at end of line, first unrecognized character is
0’
hello.s:1: 错误: junk at end of line, first unrecognized character is @' hello.s:1: 错误: junk at end of line, first unrecognized character is
(’
hello.s:1: 错误: junk at end of line, first unrecognized character is @' hello.s:1: 错误: junk at end of line, first unrecognized character is
8’
hello.s:1: 错误: junk at end of line, first unrecognized character is @' hello.s:1: 错误: junk at end of line, first unrecognized character valued 0x1b hello.s:1: 错误: junk at end of line, first unrecognized character valued 0x1a hello.s:1: 错误: junk at end of line, first unrecognized character valued 0x6 hello.s:1: 错误: junk at end of line, first unrecognized character valued 0x4 hello.s:1: 错误: junk at end of line, first unrecognized character is
@’
全网也没什么对的解决方法,仔细研究了下。gcc编译器没问题,问题在于gcc代码输入时大小写打错了!!!
正确命令如下
gcc -E hello.c -o hello.i -v
gcc -S hello.i -o hello.s -v
gcc -c hello.s -o hello.o -v
生成.s文件时 gcc -S 的s要大写
否则后面 gcc -c 生成.o文件时 就会出错!!