Hi, I also ought the book: Assembly Language For Intel-Based Computers. It uses a file called "Irvine32.inc". It's included on the CD-Rom. The book says that I have to put it in the "include" directory. So I put Irvine32.inc in the "\masm32\Include\" dir.
But it didnt work so I also put the Irvine32.lib in the "\masm32\lib\" dir (as I read in these forums :bg). The error was gone but now I get this error when I use the Build All option:
Assembling C:\masm32\Hello.asm
C:\masm32\Hello.asm(10) : fatal error A1000: cannot open file : Irvine32.inc
_
Assembly error
Press any key to continue...
What did I do wrong? (I have full administrative rights in case it matters)
I think your problem is current directory which is not current... I'm not able to use batch file directly (from explorer with 2-click or TC window) anymore, instead I have to execute the batch from console (Run->"cmd")
My current directory is "C:\masm32\"... I don't get it.
I use masm V8.2 btw.
I assumed you have "compile.bat" (something like that), but it seems you are using QEditor...and menu command "build all".
Yes I use the QEditor... Is there another way to compile and to bypass that error (without using the QEditor if nessecary)?
I am new to ASM. And my book is not telling me how to compile at all...
I'm not sure... You can use IDE like RadASM or create batch file (like I did) and execute like I wrote...:
C:\masm32\bin\ml /c /coff /Cp code.asm
C:\masm32\bin\rc code.rc
C:\masm32\bin\link /subsystem:windows /libpath:C:\masm32\lib code.obj code.res
del *.obj *.res
pause
or (not using any resources)
C:\masm32\bin\ml /c /coff /Cp code.asm
C:\masm32\bin\link /subsystem:windows /libpath:C:\masm32\lib code.obj
del *.obj
pause
Both (Bat1+Bat2) don't work, they give the following error:
LINK: fatal error LNK1181: cannot open input file "Hello.obj"
It is not creating an *.obj file at all.
I don't know what you mean both (RadASM or batch, batch1 or batch2). But if I use f.e. compile.bat I do the fellowing Run->"cmd", cd "where are: *.asm+*.bat", compile.bat and everything's OK. This error have to be connected with path (incorrect).
make sure you have a full path:
include C:\masm32\include\irvine32.inc
and not just:
include irvine32.inc
I meant Bat1+Bat2.
I also tried RadASM now, and this one gives this error:
C:\Masm32\Include\irvine32.inc(3) : fatal error A1000: cannot open file : SmallWin.inc
So I also copied the file "SmallWin.inc" to the "inlcude" folder
Now I get another error instead (using RadASM):
C:\Masm32\Bin\ML.EXE /c /coff /Cp /nologo /I"C:\Masm32\Include" "C:\masm32\Hello.asm"
Assembling: C:\masm32\Hello.asm
C:\Masm32\Bin\LINK.EXE /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /LIBPATH:"C:\Masm32\Lib" "C:\masm32\Hello.obj"
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Hello.obj : error LNK2001: unresolved external symbol _ExitProcess@4
Hello.obj : error LNK2001: unresolved external symbol _WriteString@0
Hello.exe : fatal error LNK1120: 2 unresolved externals
WriteString is located in Irvine32. But I placed the Irvine32.lib file in the lib folder, the Irvine32.inc file in the include folder, and the Irvine32.asm in the m32lib folder... What else do I have to do?
@ aeroASM:
Thanks, If I compile in MASM32 now I don't get the 'cannot open Irvine32' error anymore but the same error as above (with RadASM) instead now :P. It's a step closer.
You also need a:
includelib c:\masm32\lib\kernel32.lib
This reduces the error to
Hello.obj : error LNK2001: unresolved external symbol _WriteString@0
Hello.exe : fatal error LNK1120: 1 unresolved external
But if those errors mean a missing library file... I thought just included the following in the program
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\irvine32.lib
include C:\masm32\include\irvine32.inc
I don't know if I did everything correct... I am not getting any output But it's compiling now without any errors :). Here is the complete code after the modifications:
; hello.asm - Windows program to print "Hello, world" using Irvine library
; To asemble/run using MASM 6.15
;
; set include=\masm615\include
; set lib=\masm615\lib
; ml /Cx /c /coff hello.asm
; link32 hello.obj kernel32.lib irvine32.lib /subsystem:console
; hello1
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\irvine32.lib
include C:\masm32\include\irvine32.inc ; from Irvine CDROM
.stack 4096
.data
greeting byte "Hello, world", 13, 10, 0 ; message to write
.code
main proc
mov edx, offset greeting
invoke WriteString ; irvine.inc: write NUL terminated string pointed to by edx
exit ; irvine.inc: a macro that calls ExitProcess
main endp
end main