Hello, i've just downloaded the latest masm assembler, version 9.0, cause i was using an older version of masm32.
But i tried to compile a simple program which doesnt do anything, but i got the following errors with the new compiler, but i dont get these errors with the older compiler.
Can someone please tell me what i should do to fix it, and why im getting the errors with the new one...
.386
.model small
.stack
.data
Var1 dd 0
.code
main proc
main endp
end main
The errors are
Quote
Assembling: blaat.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/z2
"blaat.obj"
"blaat.exe"
NUL
LINK : warning LNK4044: unrecognized option "z2"; ignored
blaat.obj : warning LNK4033: converting object format from OMF to COFF
LINK : fatal error LNK1181: cannot open input file "blaat.exe"
You are trying to build 16 bit DOS code with a 32 bit system. You can use ML from MASM32 but you need to get the old OMF linker from Microsoft to build DOS files. The linker command line is different on the old one to a 32 bit linker.
You can get the linker at the forum web site.
ohhh, but i dont really want to write 16 bit dos code...
I would like to write DOS apps, but with Win32 code, so how would i change this code into a win32 asm code..??
nofx,
At a minimum use:
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
.data
Var1 dd 0
.code
start:
call WinMain
invoke ExitProcess, eax
WinMain proc
xor eax,eax
ret
WinMain endp
end start
Use the following line to build it:
\masm32\bin\build.bat minimum
Paul
Thanks alot, atleast the compiling works now :U
But just out of curiousity, how would the code look like if i wanted to use the ml.exe to assemble the code..?
nofx,
If you are using build.bat, it contains:
@echo off
if exist "%1.obj" del "%1.obj"
if exist "%1.exe" del "%1.exe"
\masm32\bin\ml /c /coff "%1.asm"
if errorlevel 1 goto errasm
if not exist rsrc.obj goto nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF "%1.obj" rsrc.obj
if errorlevel 1 goto errlink
dir "%1.*"
goto TheEnd
:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS /OPT:NOREF "%1.obj"
if errorlevel 1 goto errlink
dir "%1.*"
goto TheEnd
:errlink
echo _
echo Link error
goto TheEnd
:errasm
echo _
echo Assembly Error
goto TheEnd
:TheEnd
pause
You can see from examining the fourth line down that ml.exe is being used to assemble the code.
Okay?
Paul