NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: nobody on September 12, 2005, 04:10:23 AM

Title: NB Linker Problem
Post by: nobody on September 12, 2005, 04:10:23 AM
I am using a VC++6 linker, link.exe. Whenever I try linking I get error 2001:

unresolved external symbol MesageBoxA
unresolved external symbol ExitProcess

Here is my asm file:

%INCLUDE "..\..\inc\win32n.inc"

extern MessageBoxA
extern ExitProcess

SECTION CODE USE32 CLASS=CODE
global _WinMain
_WinMain:

PUSH UINT MB_OK
PUSH LPCTSTR title1
PUSH LPCTSTR string1
PUSH HWND NULL
CALL MessageBoxA

PUSH UINT NULL
CALL ExitProcess

SECTION DATA USE32 CLASS=DATA
string1: db 'Hello world!',13,10,0
title1: db 'Hello',0

I am using the following to assemble my executable:

NasmW.exe -f win32 msgbox1.asm
Link.exe /entry:WinMain /subsystem:windows msgbox1.obj"

What am I doing wrong?
Title: Re: NB Linker Problem
Post by: nobody on September 12, 2005, 12:59:53 PM
>  am using the following to assemble my
> executable:
>
> NasmW.exe -f win32 msgbox1.asm
> Link.exe /entry:WinMain /subsystem:windows msgbox1.obj"

Try:
set LIB=DIRIVE:\PATH\TO\MSVC\LIBRARIES
NasmW.exe -f win32 msgbox1.asm
Link.exe /entry:WinMain /subsystem:windows msgbox1.obj user32.lib kernel32.lib

------
nmt
Title: Re: NB Linker Problem
Post by: nobody on September 13, 2005, 01:31:29 AM
I'm still getting the same error. I've also tried:
Link.exe /entry:WinMain /libpath:"C:\Lib" /subsystem:windows msgbox1.obj user32.lib kernel32.lib
Thanks for helping.
Title: Re: NB Linker Problem
Post by: nasm64developer on September 13, 2005, 10:26:57 PM
> unresolved external symbol MesageBoxA
> unresolved external symbol ExitProcess
> [...]
> What am I doing wrong?

You need to link your object file against some
other object file / library / module that provides
those two symbols.