【发布时间】:2017-08-05 10:06:07
【问题描述】:
我使用的是 Debian 9。这些是错误:
andrea@debian:~/Assembly/sandbox$ nasm -f elf -g -F stabs sandbox.asm
sandbox.asm:8: error: comma, colon, decorator or end of line expected after operand
sandbox.asm:9: error: comma, colon, decorator or end of line expected after operand
sandbox.asm:11: error: comma, colon, decorator or end of line expected after operand
sandbox.asm:12: error: comma, colon, decorator or end of line expected after operand
这是代码:
section .data
section .text
global _start
_start:
nop
mov eax 10
mov ebx 12
mov eax 1
mov ebx 0
int 80H
nop
section .bss
导致这些错误的问题是什么,我该如何解决?
如果我使用以下代码修复操作数之间的逗号,我会得到一个不同的错误:
section .data
section .text
global_start
_start:
nop
mov eax,10
mov ebx,12
mov eax,1
mov ebx,0
int 80H
nop
section .bss
我得到的错误是:
sandbox.asm:4: warning: label alone on a line without a colon might be in error
为什么会出现此错误,我该如何解决?
【问题讨论】:
-
在您描述为“正确”的代码中,有
global_start,看起来不正确。正如我在回答中所写,它应该是global _start。在此更正之后,您在尝试编译代码时是否遇到相同的错误集?