如何正确包含.ASM文件?
在大学学习汇编器时,我遇到了以下问题:
我有3个文件(所有文件都过于简单,它们更大):
main.asm
.586
.model flat, stdcall
option casemap :none
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include module.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.data
TextBuf db 64 dup(?)
Caption db "Test caption", 0
value1 db 25
.code
main:
call StrHex_MY
invoke MessageBoxA, 0, ADDR TextBuf, ADDR Caption, 0
invoke ExitProcess, 0
end main
< strong> module.asm
.586
.model flat, c
.code
StrHex_MY proc
xor eax, eax
StrHex_MY endp
end
module.inc
EXTERN StrHex_MY : proc
在尝试编译它后,我遇到了错误:
C:\SystemProgramming\lab2copy>ml.exe /c /coff main.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: main.asm
C:\SystemProgramming\lab2copy>link.exe /subsystem:console main.obj
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
main.obj : error LNK2001: unresolved external symbol _StrHex_MY
main.exe : fatal error LNK1120: 1 unresolved externals
如何正确包含文件?
When studying assembler at the university, I encountered the following problem:
I have 3 files (all of them oversimplified, they were much bigger):
main.asm
.586
.model flat, stdcall
option casemap :none
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include module.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.data
TextBuf db 64 dup(?)
Caption db "Test caption", 0
value1 db 25
.code
main:
call StrHex_MY
invoke MessageBoxA, 0, ADDR TextBuf, ADDR Caption, 0
invoke ExitProcess, 0
end main
module.asm
.586
.model flat, c
.code
StrHex_MY proc
xor eax, eax
StrHex_MY endp
end
module.inc
EXTERN StrHex_MY : proc
And after trying to compile it I got error:
C:\SystemProgramming\lab2copy>ml.exe /c /coff main.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: main.asm
C:\SystemProgramming\lab2copy>link.exe /subsystem:console main.obj
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
main.obj : error LNK2001: unresolved external symbol _StrHex_MY
main.exe : fatal error LNK1120: 1 unresolved externals
How I can include file properly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:
我只是在编译错误
Solution:
I just was compiling it incorrectly