News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

compile errors

Started by nofx, September 24, 2006, 02:13:39 PM

Previous topic - Next topic

nofx

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"

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

nofx

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

PBrennick

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
The GeneSys Project is available from:
The Repository or My crappy website

nofx

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

PBrennick

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

The GeneSys Project is available from:
The Repository or My crappy website