Home > Back-end >  Error code A4011 multiple .MODEL directives, but I only have one in my code
Error code A4011 multiple .MODEL directives, but I only have one in my code

Time:09-26

I am using Visual studio 2022 Community using MASM and Kip Irvine's libs and such. I have to use them for the class I am in currently ( both VS and Kip ) It took me days to figure out how to just get all the file pathing right, now the only problem I am having is this error about the "multiple" .MODEL directives.

Here is my code:

.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

CodePudding user response:

When you do include \Irvine\Irvine32.inc it indirectly includes (via SmallWin.inc):

.686P
.MODEL flat, stdcall
.STACK 4096

To fix this just remove your .model directive when including irvine32.inc. As well you can remove your .stack and CPU directive (.386).

  • Related