The MASM Forum

General => The Campus => Topic started by: samcp12 on July 29, 2013, 03:50:28 PM

Title: Newbie Question
Post by: samcp12 on July 29, 2013, 03:50:28 PM
Hello, I recently began learning masm32 and I have to say I'm really enjoying it, the one thing I can't seem to figure out is compiling through the command line. I have been following Iczelion's tutorials and they are really great, whats troubling me is when I get to this line.


  ml  /c  /coff  /Cp msgbox.asm


I get a A100 error, I understand this is because the file is not in the same directory as ml.exe, is there a way I can compile a program without the asm files being in the same directory as ml.exe?

Thanks and sorry If I am being a little unclear :P
Title: Re: Newbie Question
Post by: jj2007 on July 29, 2013, 04:00:00 PM
You start from the folder of your source, and supply the full path to ml:

\Masm32\bin\ml.exe /nologo /c /coff Msg.asm

The source, of course, must contain the path to the includes (no C: etc please):
include \masm32\include\masm32rt.inc

.code
start:        MsgBox 0, "Hello World", "Masm32:", MB_OK
        exit

end start


Welcome to the forum :icon14:
Title: Re: Newbie Question
Post by: anta40 on July 29, 2013, 04:01:16 PM
Quote from: samcp12 on July 29, 2013, 03:50:28 PM
is there a way I can compile a program without the asm files being in the same directory as ml.exe?

Sure. I made a batch file that should be run first before assembling:

@echo off
set PATH=%PATH%;C:\masm32\bin


Or if you are kinda lazy, just put in %PATH% permanently.
Title: Re: Newbie Question
Post by: jj2007 on July 29, 2013, 04:28:41 PM
Using environment variables is one way to assure that your proggies run on your puter only. There are really good reasons why Masm32 has hard-coded paths.
Title: Re: Newbie Question
Post by: anta40 on July 29, 2013, 05:00:15 PM
Well, MASM32 by default will be installed in C:\masm32, and I only put the bin directory in PATH.
The source codes themselves are not touched. So this should be safe, no?

:biggrin:
Title: Re: Newbie Question
Post by: ragdog on July 29, 2013, 05:21:13 PM
You can use a  other way without set the  environment variables

\masm32\bin\ml  /c  /coff  /Cp msgbox.asm
\masm32\bin\link /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /OUT:"msgbox.exe" "msgbox.obj" 
Title: Re: Newbie Question
Post by: samcp12 on July 29, 2013, 09:04:12 PM
Thanks guys! I managed to get it working, seems like a really great forum.
Title: Re: Newbie Question
Post by: Gunther on July 30, 2013, 03:07:35 AM
Hi samcp12,

Quote from: samcp12 on July 29, 2013, 09:04:12 PM
Thanks guys! I managed to get it working, seems like a really great forum.

yes indeed. And welcome to the forum.

Gunther
Title: Re: Newbie Question
Post by: daydreamer on August 01, 2013, 07:17:42 PM
Welcome to the forum
Magnus
Title: Re: Newbie Question
Post by: Magnum on August 02, 2013, 06:59:51 AM
Welcome to the forums.

Andy