; Library for I/O and other purposes
include c:\asmio\asm32.inc
includelib c:\asmio\asm32.lib
includelib c:\asmio\User32.lib ; SASM files for I/O
includelib c:\asmio\Kernel32.lib ; SASM files for I/O
input proto ; 0 parameters
; -------------------------------------------------------
.const ; Section to declare and initialize constants
NULL = 0
; -------------------------------------------------------
.data ; Section to declare and initialize variables
; number dword ? ;
read byte "Enter a number between 1-12: ", NULL
; -------------------------------------------------------
.code ; The actual code begins here: Main program
main proc ; Just like C++ this is the main program
invoke input
ret 0 ; need this line to return to caller
main endp ; End of the procedure main
end main ; End of the entire program
; -------------------------------------------------------
input proc
mov edx, OFFSET read
call WriteString
call ReadInt
ret
input endp
大家好,这是我要编写的第一个汇编代码。
我正在尝试创建一个过程,要求用户在1到12之间输入内容,然后将其写入main。我在main下编写了过程,在main上编写了原型,并使用invoke在main内部调用了该过程,但是遇到了错误。
我的错误:
[08:46:41] Build started...
[08:46:42] Warning! Errors have occurred in the build:
program.o : error LNK2001: unresolved external symbol _input@0
C:\Users\yp0l0\AppData\Local\Temp\SASM\SASMprog.exe : fatal error LNK1120: 1 unresolved externals
有人看到我哪里出问题了吗?
此行
end main
必须是源文件中的最后一行。因为当前它在“输入”之前,所以输入功能已从程序集中排除。