“错误A2006:未定义的符号”在window 7 64位的masm32中?
当我运行这个例子时,我收到一个错误。删除 PROC1 PROC FAR 后,我收到另一个错误“符号类型冲突”。使用 /coff:“起始地址需要前导下划线:START”。
Microsoft (R) 宏汇编器版本 6.14.8444 版权所有 (C) Microsoft Corp 1981-1997。保留所有权利。
汇编:D:\Linux\test1.asm D:\Linux\test1.asm(28) : 错误 A2006: 未定义符号 : START
D:\Linux\test1.asm(16) : 错误 A2004: 符号类型冲突
D:\Linux\test1.asm(28) : 错误 A2148: 表达式中的符号类型无效: STAR
TITLE EXAMPLE
DATA SEGMENT
VARX DW 6
VARY DW 7
RESULT DW ?
DATA ENDS
STACK1 SEGMENT PARA STACK
DW 20H DUP(0)
STACK1 ENDS
COSEG SEGMENT
PROC1 PROC FAR
ASSUME CS:COSEG, DS:DATA, SS:STACK1
START: PUSH DS
MOV AX, 0
PUSH AX
MOV AX, DATA
MOV DS, AX
MOV DX, VARX
MOV DX, VARY
MOV CL, 3
SAL DX, CL
SUB DX, VARX
SAR DX, 1
MOV RESULT, DX
RET
PROC1 ENDP
COSEG ENDS
END START
附录:
删除开始后,在第 16 行留下错误。为什么在 MOV AX, DATA 处发生此错误?
Microsoft (R) 宏汇编器版本 6.14.8444 版权所有 (C) Microsoft Corp 1981-1997。保留所有权利。
汇编:D:\Linux\test1.asm D:\Linux\test1.asm(16) : 错误 A2004: 符号类型冲突
When i run this example, I get an error. After removing PROC1 PROC FAR, I get another error "symbol type conflict". With /coff: "leading underscore required for start address : START".
Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: D:\Linux\test1.asm D:\Linux\test1.asm(28) : error A2006: undefined symbol : START
D:\Linux\test1.asm(16) : error A2004: symbol type conflict
D:\Linux\test1.asm(28) : error A2148: invalid symbol type in expression : STAR
TITLE EXAMPLE
DATA SEGMENT
VARX DW 6
VARY DW 7
RESULT DW ?
DATA ENDS
STACK1 SEGMENT PARA STACK
DW 20H DUP(0)
STACK1 ENDS
COSEG SEGMENT
PROC1 PROC FAR
ASSUME CS:COSEG, DS:DATA, SS:STACK1
START: PUSH DS
MOV AX, 0
PUSH AX
MOV AX, DATA
MOV DS, AX
MOV DX, VARX
MOV DX, VARY
MOV CL, 3
SAL DX, CL
SUB DX, VARX
SAR DX, 1
MOV RESULT, DX
RET
PROC1 ENDP
COSEG ENDS
END START
Addendum:
After removing start, it left error at line 16. Why happens this error at MOV AX, DATA
?
Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: D:\Linux\test1.asm D:\Linux\test1.asm(16) : error A2004: symbol type conflict
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 START 是在过程内部定义的,因此它在过程外部不是有效的标识符。
另外,如果它确实有效,你就会创建一个错误。 PROC 是一个扩展为设置堆栈帧的宏,因此标签 START 实际上并不位于代码的开头,而 END START 表示程序的入口点是 START。如果您希望程序以主过程开始,您应该在 END 之后使用该过程的名称,例如 END PROC1。
如果您确实打算将入口点设置到过程中的某个位置,则可以使用 OPTION NOSCOPED 和 OPTION SCOPED 包围标签,这样标签将是公共的,而不仅仅是在过程中可见。
Because START is defined inside a procedure, it is not a valid identifier outside it.
Also, if it did work you would be creating a bug. PROC is a macro that expands to setup a stack frame, so your label START is not actually at the start of the code, while END START indicates that the entry point for your program is START. If you want your program to start with a main procedure you should just use the name of that procedure after END, like END PROC1.
If it really was your intent to set the entry point to somewhere in your procedure, you could surround the label with OPTION NOSCOPED and OPTION SCOPED, so the label will be public, and not just visible inside the procedure.