hello. i want to learn ASM but i'm still at the 'haven't got anything to even compile yet' stage.  so i was wondering if anybody could help me try and figure out how to successfully compile something.

i've been trying to do the first console example that actually comes with the masm software:

; ?????????????????????????????????????????????????????????????????????????

;                Build this with the "Project" menu using
;                      "Console Assemble and Link"

; ?????????????????????????????????????????????????????????????????????????

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive

    include \masm32\include\windows.inc    ; always first
    include \masm32\macros\macros.asm      ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc

  ; ------------------------------------------------
  ; Library files that have definitions for function
  ; exports and tested reliable prebuilt code.
  ; ------------------------------------------------
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib

    .code                      ; Tell MASM where the code starts

; ?????????????????????????????????????????????????????????????????????????

start:                          ; The CODE entry point to the program

    print chr$("Hey, this actually works.",13,10)

; ?????????????????????????????????????????????????????????????????????????

end start                      ; Tell MASM where the program ends

anyway what happens is:

C:\masm32\tutorial\console\demo1>ml /c /coff hello.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: hello.asm

C:\masm32\tutorial\console\demo1>link hello.obj
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : fatal error LNK1221: a subsystem can't be inferred and must be defined


the reason i used /c was because it was giving a linking error on the running of ml. and the reason i use /coff is because it was telling me there was a problem converting from OMF to COFF in the linking stage.

thanks for any pointers in the right direction.

Posted on 2007-03-11 11:39:19 by Aradesh
hi Aradesh

use this commands

\masm32\bin\ml /c /coff hello.asm
\masm32\bin\link /SUBSYSTEM:CONSOLE /LIBPATH:c:\masm32\lib hello.obj

Posted on 2007-03-11 11:58:55 by ragdog
ah. thank you very much. it works now.
there are many online examples i can't get to work however - but hopefully once i've studied the examples that come with masm, i can edit them so that they do. (asuming the other examples compile nicely also)
Posted on 2007-03-11 14:18:15 by Aradesh