2

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
Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Dkeane1
  • 23
  • 2

1 Answers1

2

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).

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
  • 1
    Thankyou very much for such a quick response, I did what you said and removed the .MODEL, .STACK, and CPU directive, but that just gave me a bunch more errors. I dug a little into it, and went into SmallWin itself and turned those lines of code into comments. After I did that the code worked without a problem. Appreciate the help!! – Dkeane1 Sep 23 '22 at 22:02
  • Something else is not quite right then. It should be enough to include Irvine32.inc at the top. – Michael Petch Sep 24 '22 at 03:14