Hi all, I am a novice in win32asm and recently registered to this group. Well I tried to assemble and link a program that I got from the Tutorial at win32asm.com. I am enclosing the code here. .386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc includelib kernel32.lib include \masm32\include\user32.inc includelib user32.lib .data MsgCaption db "Iczelion's tutorial no.2",0 MsgBoxText db "Win32 Assembly is Great!",0 .code start: invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK invoke ExitProcess,NULL end start =============================== Although i could assemble it I am not able to link it to make it an exe file. The following is my command prompt out put. I am getting a message "unresolved external symbol _start" Can you help me out from this. ========================== C:\masm32\MyExamples>ml /c /coff /IC:\masm32\Include msgbox.asm Microsoft (R) Macro Assembler Version 6.11d Copyright (C) Microsoft Corp 1981-1995. All rights reserved. Assembling: msgbox.asm C:\masm32\MyExamples>link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\Lib msgbox.obj Microsoft (R) Incremental Linker Version 6.00.8168 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. LINK : error LNK2001: unresolved external symbol __start msgbox.exe : fatal error LNK1120: 1 unresolved externals ================== bye ranjith
Hi, I think the problem is that the library path is incorrect. You use:
But you should use:
This is the default library path of masm32. Hope I could help you. Greetings, w116
The linker I got with the masm32 pack was version 5.12.8078 You seem to be using version 6... You also seem to be using ml 6.11, not 6.14 There may be some problems with this. Did you download Hutch's masm32 package? If you did, do you also have Visual C++ or any other compiler that uses "link.exe"? This may be in the path higher than masm32, so it will take priority.... Mirno
I droped your program into Quick Editor,saved it and compliled. It all worked. It ever RAN. So, the problem must be in your build statements. MASM32 uses these in it's BLDALL.BAT file: \masm32\bin\ml /c /Fl /coff %1.asm \masm32\bin\Link /SUBSYSTEM:WINDOWS %1.obj
try adding /entry:start to the linker commandline. Iirc, masm does not add leading underscores to public names (I might be wrong, though). Or try renaming your "start" to "_start".
I don't know if it's still true, but I've had to make the symbol public when using /entry.
If the stdcall option doesn't add '_', you'll need to rename start to _start in the ASM file. The linker option, however, does NOT use the '_'.
public start start:
link /entry:start /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\Lib msgbox.obj