assembly 错误代码A4011多个.MODEL指令,但我的代码中只有一个

cidc1ykv  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(81)

我正在使用Visual Studio 2022社区使用MASM和Kip Irvine的库等。我必须使用它们的类,我目前在(VS和Kip)我花了几天的时间来弄清楚如何只是得到所有的文件路径的权利,现在我唯一的问题是这个错误的“多”。MODEL指令。
下面是我的代码:

.386
.MODEL flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword

includelib \Irvine\Irvine32.lib
include    \Irvine\Irvine32.inc
include    \Irvine\macros.inc
includelib \Irvine\kernel32.lib

.data
    prompt1 db "Please enter your Name >> ",0
    prompt2 db "Please enter your age >>",0
    fname db 20 DUP(?)
    age DWORD ?
    prompt3 db "Your name is: ",0
    prompt4 db "Your age is: ",0
    

.code
main proc
    mov edx,offset prompt1
    call writestring

    mov edx, offset fname
    mov ecx, sizeof fname
    call readstring
    call Crlf

    mov edx, offset prompt2
    call writestring
    
    call Readdec
    mov age,eax
    call Crlf

    mov edx, offset prompt3
    call writestring
    
    mov edx,offset fname
    call writestring
    call Crlf
    mov edx, offset prompt4
    call writestring
    
    mov eax,age
    call writedec
    call Crlf

    invoke ExitProcess,0
main endp
end main
deyfvvtc

deyfvvtc1#

当您执行include \Irvine\Irvine32.inc时,它间接包含(通过SmallWin.inc):

.686P
.MODEL flat, stdcall
.STACK 4096

要解决这个问题,只需在包含irvine32.inc时删除.model指令。同样,您也可以删除.stack和CPU指令(.386)。

相关问题