[英]How I can include .asm file properly?
When studying assembler at the university, I encountered the following problem:在大学学习汇编时,遇到了如下问题:
I have 3 files (all of them oversimplified, they were much bigger):我有 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
module.asm模块.asm
.586
.model flat, c
.code
StrHex_MY proc
xor eax, eax
StrHex_MY endp
end
module.inc模块.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?如何正确包含文件?
Solution:解决方案:
I just was compiling it incorrectly我只是编译错误
ml /c /coff main.asm
ml /c /coff module.asm
link /subsystem:console main.obj module.obj
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.