汇编(Intel语法+ NASM)错误:尝试在任何非本地标签之前定义本地标签 [英] Assembly (Intel syntax + NASM) Error: attempt to define a local label before any non-local labels
问题描述
关于程序集,我很新,我正在尝试使用某个程序.因此,每当我尝试对其进行编译时,都会得到该行的错误,如代码注释中所列.
I am quite new regarding the assembly and I am trying to work with a program. So whenever I try to compile it, I get the error for the line, as listed under the comments in the code.
我想知道是否有人对我为其余汇编代码定义某些内容时NASM为什么会检测到此错误吗?
也许它必须与main的定义有关系吗?
Maybe it has to do something with how the main is defined?
P.S.因为程序很长,所以我只列出了代码的第一部分.
P.S. I listed just the first part of the code, since the program is quite long.
感谢您的帮助
.xlist ;attempt to define a local label before any non-local labels
include stdlib.a ; parser: instruction expected
includelib stdlib.lib ; parser: instruction expected
.list
.286
dseg segment para public 'data'
; Unknown section attribute 'public' ignored on declaration of section `para'
h word ?
i word ?
cseg segment para public 'code'
assume cs:cseg, ds:dseg
Main
推荐答案
在NASM中,以点开头的标签称为本地标签.它被附加到最后一个全局标签,例如,
In NASM a label starting with dot is called a local label. It is appended to the last global label, for example,
L:
.l2: ; it is really L.l2
因此,您不能在任何全局标签之前拥有本地标签
So you cannot have a local label before any global ones
这篇关于汇编(Intel语法+ NASM)错误:尝试在任何非本地标签之前定义本地标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!