The MASM Forum Archive 2004 to 2012

Project Support Forums => MASM32 => Topic started by: all4u4me on June 10, 2010, 02:42:05 AM

Title: error when compiler file msgbox.asm
Post by: all4u4me on June 10, 2010, 02:42:05 AM
when i compiler file asm msgbox then i get a message error . i can't solved it .pls help me . thks .

after is file asm and command compiler.

file asm :

.386
.model flat, stdcall
option casemap:none


include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\msvcrt.inc


include \masm32\lib\user32.lib
include \masm32\lib\kernel32.lib


.data
MsgBoxCaption db "This is a simple messagebox",0
MsgBoxText db "Xin chao !",0

.code

start:
invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK
invoke ExitProcess, NULL
end start

I get a message error follow :


F:\masm32>masm.exe msgbox.asm
Microsoft (R) Macro Assembler Version 5.10
Copyright (C) Microsoft Corp 1981, 1988.  All rights reserved.

Object filename [msgbox.OBJ]:
Source listing  [NUL.LST]:
Cross-reference [NUL.CRF]:
\masm32\include\windows.inc(412): error A2004: Redefinition of symbol
\masm32\include\windows.inc(913): error A2106: Line too long
\masm32\include\windows.inc(5230): error A2004: Redefinition of symbol
\masm32\include\windows.inc(5238): error A2004: Redefinition of symbol
\masm32\include\windows.inc(5239): error A2004: Redefinition of symbol
\masm32\include\windows.inc(6347): error A2106: Line too long
\masm32\include\windows.inc(6357): error A2106: Line too long
\masm32\include\windows.inc(6410): error A2106: Line too long
\masm32\include\windows.inc(6413): error A2106: Line too long
\masm32\include\windows.inc(10926): error A2106: Line too long
\masm32\include\windows.inc(11770): Out of memory
Title: Re: error when compiler file msgbox.asm
Post by: dedndave on June 10, 2010, 02:49:15 AM
it looks like MsgBoxCaption and/or MsgBoxText are labels that are already in use
try changing the names a little so they are unique to your program
MBoxCaption1 db "This is a simple messagebox",0
MBoxText1    db "Xin chao !",0


usually, when you have a long list of errors like that, look at the first few
quite often, fixing the earlier error(s) eliminates many of the other error messages   :U
in this case, the very first one tells you what the problem is
Title: Re: error when compiler file msgbox.asm
Post by: aker on June 10, 2010, 02:53:16 AM
Your source is  not for Microsoft (R) Macro Assembler Version 5.10.

Newer Assemblers:
Microsoft (R) Macro Assembler Version 6.14.8444 (MASM32 v10)
Microsoft (R) Macro Assembler Version 6.15.8803 (VC++ 6.0 Service Pack 5)
Microsoft (R) Macro Assembler Version 7.00.9466 (Visual Studio .NET Enterprise Architect chinese simplified)
Microsoft (R) Macro Assembler Version 7.10.4035 (WRK v1.2)
Microsoft (R) Macro Assembler Version 8.00.50727.278 (Windows DDK 6001.18001)
Microsoft (R) Macro Assembler Version 8.00.50727.762 (Visual Studio 2005 and Windows Vista SDK)
Microsoft (R) Macro Assembler Version 9.00.30729.01 (Windows 7 SDK Beta, Windows SDK for Windows 7 and .NET Framework 3.5 SP1)
Microsoft (R) Macro Assembler Version 9.00.30729.207 (Windows Driver Kit 7.1.0 7600.16385.1)
Microsoft (R) Macro Assembler Version 10.00.20506.01 (Visual Studio 2010 Beta 1)
Microsoft (R) Macro Assembler Version 10.00.30319.01 (Visual Studio 2010 Ultimate simplified and Windows SDK for Windows 7 and .NET Framework 4)
Title: Re: error when compiler file msgbox.asm
Post by: dedndave on June 10, 2010, 03:02:28 AM
good eye, Aker - lol   :U

you should install the masm32 package, and use the assembler that comes with it
perhaps your old assembler is in the PATH environment variable and the \masm32\bin folder is not

http://www.masm32.com/board/index.php?topic=14154.msg112459#msg112459
Title: Re: error when compiler file msgbox.asm
Post by: all4u4me on June 10, 2010, 03:29:47 AM
I had config environment variable follow your tutorial but i get a error message other :

C:\masm32>ml /Zi msgbox.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: msgbox.asm
\masm32\lib\user32.lib(1) : error A2008: syntax error : !
\masm32\lib\user32.lib(2) : error A2044: invalid character in file
\masm32\lib\user32.lib(3) : error A2044: invalid character in file
\masm32\lib\user32.lib(4) : error A2044: invalid character in file
\masm32\lib\user32.lib(4) : error A2039: line too long
\masm32\lib\user32.lib(5) : error A2044: invalid character in file
\masm32\lib\user32.lib(6) : error A2044: invalid character in file
\masm32\lib\user32.lib(7) : error A2044: invalid character in file
\masm32\lib\user32.lib(8) : error A2044: invalid character in file
\masm32\lib\user32.lib(9) : error A2044: invalid character in file
\masm32\lib\user32.lib(10) : error A2044: invalid character in file
\masm32\lib\user32.lib(11) : error A2044: invalid character in file
\masm32\lib\user32.lib(12) : error A2044: invalid character in file
\masm32\lib\user32.lib(13) : error A2044: invalid character in file
\masm32\lib\user32.lib(14) : error A2044: invalid character in file
\masm32\lib\user32.lib(15) : error A2044: invalid character in file
\masm32\lib\user32.lib(16) : error A2044: invalid character in file
\masm32\lib\user32.lib(17) : error A2044: invalid character in file


i set environment variable in Path is : C:\masm32\bin
Title: Re: error when compiler file msgbox.asm
Post by: clive on June 10, 2010, 03:36:24 AM
You can't include library files like this

include \masm32\lib\user32.lib
include \masm32\lib\kernel32.lib


You want this

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
Title: Re: error when compiler file msgbox.asm
Post by: aker on June 10, 2010, 03:41:31 AM
Good eye, clive - lol :U
Title: Re: error when compiler file msgbox.asm
Post by: dedndave on June 10, 2010, 04:01:24 AM
 :bg
or, you can do as most of us do.....
        include \masm32\include\masm32rt.inc
that file has most of the commonly used includes and includelibs
as an alternative, open that file and copy/paste all the stuff out of it

edit - that will prevent typos, at least
and things like - you have the include for msvcrt, but not the library

(good eye, Dave - lol)
Title: Re: error when compiler file msgbox.asm
Post by: oex on June 10, 2010, 04:40:15 AM
or indeed use the uselib macro

ie

uselib user32, kernel32
Title: Re: error when compiler file msgbox.asm
Post by: all4u4me on June 10, 2010, 05:25:42 AM
I solved it   :wink , thks very much to everybody  :dance: