The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: hack004 on February 04, 2009, 04:27:20 PM

Title: ? Connect when prompted to connect database error - -!
Post by: hack004 on February 04, 2009, 04:27:20 PM
Compilation of the book to see book intel compiled version 5 the following code compiled by connecting Error `
-------------------------------------------------- ---------
INCLUDE Irvine32.inc
. code
main PROC

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

     exit
main ENDP
END main
------------------------------------------
Code is written on the band `! Hope that, under the guidance of a master!
Error message is: link.exe / SUBSYSTEM: WINDOWS / nologo / OUT: "AddSub.exe" "AddSub.obj"
AddSub.obj: error LNK2001: unresolved external symbol _ExitProcess @ 4
AddSub.obj: error LNK2001: unresolved external symbol _DumpRegs @ 0
AddSub.exe: fatal error LNK1120: 2 unresolved externals
:red :red :red :red
Title: Re: ? Connect when prompted to connect database error - -!
Post by: d0d0 on February 04, 2009, 05:03:10 PM
howdy,

i think you're having problems linking to the authors library i.e. irvine32.lib

where are you trying to build it from?

checkout his site: http://kipirvine.com/asm/
Title: Re: ? Connect when prompted to connect database error - -!
Post by: MichaelW on February 04, 2009, 05:27:05 PM
I see 3 problems with your link command line:

You are not linking with irvine32.lib, and this explains why the linker cannot find the DumpRegs procedure.

You are not linking with kernel32.lib, and this explains why the linker cannot find the ExitProcess function.

You are specifying /SUBSYSTEM:WINDOWS instead of /SUBSYSTEM:CONSOLE, so the application will not have a console, and the DumpRegs procedure depends on a console to display its output.

Assuming that you are working in a directory on the drive were MASM32 is installed, and that irvine32.lib, irvine32.inc, and SmallWin.inc are present, this batch file should be able to assemble and link without problems:

\masm32\bin\ml /c /coff addsub.asm
pause
\masm32\bin\Link addsub.obj irvine32.lib \masm32\lib\kernel32.lib /SUBSYSTEM:CONSOLE
pause
addsub
pause

Title: Re: ? Connect when prompted to connect database error - -!
Post by: hack004 on February 05, 2009, 07:57:46 AM
Thank you very much for the help! However, I as you say where in the code to add includelib irvine32.lib and after includelib kernel32.lib! With you to the tips of the batch error fltal error A1000: cannot open file: Irvine32.inc environment variable I set up of the:
@ echo off
set include = c: \ masm32 \ Include; D: \ VC98 \ Include; D: \ VC98 \ MFC \ Include
set lib = c: \ masm32 \ lib
set path = c: \ masm32 \ bin;% path%
echo on
I hope you can help me! Very grateful :red :(
Title: Re: ? Connect when prompted to connect database error - -!
Post by: MichaelW on February 05, 2009, 09:06:10 AM
Irvine32.inc includes the line:

INCLUDE SmallWin.inc

And SmallWin.inc includes the line:

includelib irvine32.lib

Sorry, I did not see the above line until now. So assuming the system can find irvine32.lib, you should not have to include it on the LINK command line (although doing so will not cause problems).

As I tried to state, I'm working in the directory that contains irvine32.lib, irvine32.inc, and SmallWin.inc, and most programming tools know to look in the current directory, so there is no need for me to specify where these files are. I also generally don't directly use environment variables. Since you apparently do, I changed my working directory so it contains only the source file and the batch file, moved the irvine32 files to c:\irvine32\, and updated the batch file so it sets the necessary environment variables and depends on these to specify where the files are. Note that there are no spaces in the paths.

set include=c:\irvine32
set lib=c:\masm32\lib;c:\irvine32
set path=c:\masm32\bin;%path%

ml /c /coff addsub.asm
pause
Link addsub.obj kernel32.lib /SUBSYSTEM:CONSOLE
pause
addsub
pause

Title: Re: ? Connect when prompted to connect database error - -!
Post by: hack004 on February 05, 2009, 11:24:27 AM
Hi, friends!
   I, like you said, as modified after the prompt:
Assembling: addsub.asm
error A4910: cannot open file: C: \ masm32 \ bin \ ml.err
addsub.asm <15>: error A2006:: DumpRegs
--------------------------------------
I do not know I was wrong to amend the code does not
INCLUDE SmallWin.inc
includelib irvine32.lib

. code
main PROC

Mov eax, 10000h; EAX = 10000h
Add eax, 40000h; EAX = 50000h
Sub eax, 20000h; EAX = 30000h
Call DumpRegs

Exit
main ENDP
END main
------------------
You can leave your contact way? As may be able to chat a little more clearly! Very grateful!
Title: Re: ? Connect when prompted to connect database error - -!
Post by: hack004 on February 05, 2009, 12:16:55 PM
MichaelW thank you very much!
Although I did not under your guidance, but my friend helped me, and have no problem! My heartfelt thank you!