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?
CodePudding user response:
Solution:
I just was compiling it incorrectly
ml /c /coff main.asm
ml /c /coff module.asm
link /subsystem:console main.obj module.obj