News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Super newbie :-) Problems with first program

Started by alzamabar, March 30, 2009, 10:11:32 PM

Previous topic - Next topic

alzamabar

Hi all,

I'm reading Kip R. Irvine book 'Assembly language for intel-based computers'. I am a complete newbie to assembly code (although I have got several years experience in Java). I'm running on Windows XP SP3. Have installed Masm32 and also an IDE (WinAsm). I'm trying a program on the book with the following code:


TITLE Hello World

; This program is an hello world program

INCLUDE Irvine32.inc

.code
main PROC

mov eax,10000h ; EAX = 10000h
add eax,40000h ; EAX = 50000h
sub eax,20000h ; EAX = 30000h
call DumpRegs ; display registers

exit
main EndP

END main



I have added Irvine32.inc source in \masm32\include. The program assembles fine, but when I try to link it I get the following exceptions:


helloworld.obj : error LNK2001: unresolved external symbol _ExitProcess@4
helloworld.obj : error LNK2001: unresolved external symbol _DumpRegs@0
C:\Projects\assembler\helloworld.exe : fatal error LNK1120: 2 unresolved externals


I have no idea on how to solve this problem. Any help would be appreciated. Thanks. I know that it's something to do with the included library. In fact, if I remove the references to Irvine32.inc the program compiles and runs fine (although it doesn't do anything special)

M.


brethren

its probably not a good idea to stick the Irvine32.inc and Irvine32.lib files in with the the masm32 project, just extract all the files to somewhere like C:\Irvine

then add these lines to your program

INCLUDE \Irvine\Irvine32.inc
INCLUDELIB \Irvine\Irvine32.lib
INCLUDELIB \Irvine\kernel32.lib


btw why not use the batch files that come with the cd to assemble your program? Or you could go to kip irvine's website and download the latest version of his library, the files will be installed to \Irvine by default

alzamabar

Quote from: brethren on March 30, 2009, 10:35:09 PM
its probably not a good idea to stick the Irvine32.inc and Irvine32.lib files in with the the masm32 project, just extract all the files to somewhere like C:\Irvine

then add these lines to your program

INCLUDE \Irvine\Irvine32.inc
INCLUDELIB \Irvine\Irvine32.lib
INCLUDELIB \Irvine\kernel32.lib


btw why not use the batch files that come with the cd to assemble your program? Or you could go to kip irvine's website and download the latest version of his library, the files will be installed to \Irvine by default

Wow, many very useful informations all at once. To answer to the CD question the answer is...Because I haven't got one :-) As for the code, I downloaded the latest version from Irvine's website but unzipped in a location of my choice.  I'll do as you say and see if anything changes. One thing I wanted to say though is that the example in his book doesn't mention the additional INCLUDELIB entries, as per your post above. And this is quite sad, since I'm completely new to this kind of stuff and wouldn't be able to figure it out myself. But without working examples I can't really make big progresses because I can't see things evolving.

Thank you for your time and your precious help.

M.

brethren

He doesn't use the INCLUDELIB directive or provide the complete path to Irvine32.inc as his batch files take care of all that. Now if I was you I would follow these instructions

http://kipirvine.com/asm/gettingStarted/index.htm

that way you'll be able to run the programs in his book without modification, it'll make your path to learning easier:)



alzamabar

Quote from: brethren on March 31, 2009, 09:20:10 PM
He doesn't use the INCLUDELIB directive or provide the complete path to Irvine32.inc as his batch files take care of all that. Now if I was you I would follow these instructions

http://kipirvine.com/asm/gettingStarted/index.htm

that way you'll be able to run the programs in his book without modification, it'll make your path to learning easier:)


Thank you. Your information were extra-helpful. Have you studied this book yourself?

M.