我正在创建一个应用程序来测试api函数IsCharLowerA,然后使用MessageBoxA输出res。我正在使用masm32。
link /SUBSYSTEM:WINDOWS kod.obj
microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) microsoft Corp 1992-1998. All rights reserved.
kod.obj : warning LNK4033: converting object format from OMF to COFF
kod.obj : error LNK2001: unresolved external symbol __ExitProcess@4
kod.obj : error LNK2001: unresolved external symbol __MessageBoxA@16
kod.obj : error LNK2001: unresolved external symbol __imp__printf
kod.obj : error LNK2001: unresolved external symbol __imp__scanf
kod.obj : error LNK2001: unresolved external symbol _IsCharLowerA@4
LINK : error LNK2001: unresolved external symbol _WinmainCRTStartup
ml kod.asm
microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) microsoft Corp 1981-1997. All rights reserved.
Assembling: kod.asm
microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) microsoft Corp 1992-1998. All rights reserved.
/z2
"kod.obj"
"kod.exe"
NUL
LINK : warning LNK4044: unrecognized option "z2"; ignored
kod.obj : warning LNK4033: converting object format from OMF to COFF
LINK : fatal error LNK1181: cannot open input file "kod.exe"
我尝试使用microsoft masm32(在Visual Studio中编译代码),但是当应用程序启动时,仅要求输入一个字符然后关闭。由于出现“源不可用”错误,我无法尝试调试。
某些代码:
.586
.model flat,stdcall
option casemap: none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\msvcrt.inc
includelib C:\masm32\lib\msvcrt.lib
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\user32.lib
.data
msg db 'Enter char: ',0
messagebox_title db ' Лабораторна робота № 5 ',0
result_0 db ' NOT LOWERCASE ',0
result_1 db ' LOWERCASE ',0
scan_modifier db '%c',0
.data?
scan_res dd ?
.code
start:
push ebp
mov ebp,esp
invoke crt_printf,OFFSET msg
invoke crt_scanf,OFFSET scan_modifier,scan_res
push scan_res
call IsCharLowerA
push 0
push offset messagebox_title
cmp eax,0
jne notNULL
push offset result_0
jmp next
notNULL:
push offset result_1
next:
push 0
call MessageBoxA
push 0
call ExitProcess
pop ebp
end start
更新#1 :(已更改MessageBoxA-> MessageBoxA @ 16等)
代码:
.586
.model flat,stdcall
option casemap: none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\msvcrt.inc
includelib C:\masm32\lib\msvcrt.lib
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\user32.lib
extrn MessageBoxA@16 : PROC
extrn ExitProcess@4 : PROC
.data
msg db 'Enter char: ',0
jne notNULL
push offset result_0
jmp next
notNULL:
push offset result_1
next:
push 0
call MessageBoxA@16
push 0
call ExitProcess@4
pop ebp
end start
Res:
link /SUBSYSTEM:WINDOWS kod.obj
microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) microsoft Corp 1992-1998. All rights reserved.
kod.obj : warning LNK4033: converting object format from OMF to COFF
kod.obj : error LNK2001: unresolved external symbol _MessageBoxA@16
kod.obj : error LNK2001: unresolved external symbol __imp__printf
kod.obj : error LNK2001: unresolved external symbol _ExitProcess@4
kod.obj : error LNK2001: unresolved external symbol __imp__scanf
kod.obj : error LNK2001: unresolved external symbol _IsCharLowerA@4
LINK : error LNK2001: unresolved external symbol _WinmainCRTStartup
kod.exe : fatal error LNK1120: 6 unresolved externals
我有一个代码error LNK2001: unresolved external symbol _MessageBox(上传的#2“最终工作代码”)也无法成功链接