Qbasicnews.com

Full Version: Compiling MASM programs...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just got a MASM compiler and I finaly figured out how to make .obj files. I can't figure out how to make .coms or .exes directly. Can MASM32 make program files? How? If not, is there any way I can convert .obj files to .com or .exe files? Thanks!
You need a linker (LINK.EXE, for example). Look in your masm distro, there should be one.
Thanks! but I have one problem. Every time I try to assemble this peice of code...

Code:
.MODEL medium
.386
.STACK 100h
.CODE

mov ax,13h    
int 10h
mov ax,4Ch        
int 21h

END

...it makes the obj file but it doesn't link. It gives me this error...

Code:
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: C:\masm32\test2.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

test2.obj : warning LNK4078: multiple ".data" sections found with different attr
ibutes (C0220040)
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
test2.exe : fatal error LNK1120: 1 unresolved externals
_
Link error
Press any key to continue . . .

The error message says there are "multiple ".data" sections found with different attributes" but I don't have a ".data" statement in my code. How do I fix this?
I don't know if this is the same problem, but I think you need to specify the entry point, like so:
Code:
.MODEL medium
.386
.STACK 100h
.CODE

start:
mov ax,13h
int 10h
mov ax,4Ch
int 21h

END start

Also, that assembler looks like a DOS program, but the error message is as if you're trying to link it as a Windows exe...
In MASM there is a switch / that specifies you want to link after assemble. I primarily use TASM so I don't know the switch.

Try MASM /?
Reading the documentation would also come handy Wink