flat assembler
Message board for the users of flat assembler.
Index
> Windows > How to use linker Goto page 1, 2 Next |
Author |
|
vid 26 Feb 2009, 22:28
Quote: mscoff.obj : error LNK2001 : unresolved external symbol __imp__MessageBoxA@16 You are calling function "MessageBox" from USER32.DLL. For that, you need to link with USER32.LIB file (and usually also KERNEL32.LIB, and other depending on which Win API procs you call). You can find KERNEL32.LIB, USER32.LIB, and others in basically any compiler package, usually MS Visual Studio, Windows Driver Development Kit, or MASM32. Quote: LINK : error LNK2001 : unresolved external symbol __WinMainCRTStartup Microsoft linker by default expects that you are using standard C library (C Runtime, CRT). Because of that, it will look for .LIB file(s) of that library, and also set entry point of your application to that library, where it is called "_WinMainCRTStartup". You can override this behavior by giving "/NODEFAULTLIB" switch to linker. You may also need to provide "/SUBSYSTEM:WINDOWS" or "/SUBSYSTEM:CONSOLE" switch to compile your app. |
|||
26 Feb 2009, 22:28 |
|
habran 27 Feb 2009, 02:54
It solved "MesageBox" error but not "WinMainCRTStartup"
here are code for make.bat: Code: @echo off \fasm\fasm -s mscoff.fas mscoff.asm mscoff.o if errorlevel 1 goto errasm pecvt mscoff.fas mscoff.obj if errorlevel 1 goto errpecvt \masm32\BIN\Link.exe /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /VERSION:1.0 /INCREMENTAL:YES /NODEFAULTLIB \Masm32\Lib\USER32.LIB mscoff.obj if errorlevel 1 goto errlink goto TheEnd :errlink echo _ echo Link error goto TheEnd :errasm echo _ echo Assembly Error goto TheEnd :errpecvt echo _ echo pecvt Error goto TheEnd :TheEnd dir mscoff.* pause what is wrong with it? regards _________________ down under |
|||
27 Feb 2009, 02:54 |
|
sinsi 27 Feb 2009, 02:59
Try adding "/ENTRY:start" to the link command line (replace "start" with your entry point's label).
|
|||
27 Feb 2009, 02:59 |
|
habran 27 Feb 2009, 10:54
Thank sinsi, I tried but than I got error :
LINK : error LNK2001 : unresolved external symbol "_start" I would like to find a solution for that because I don't believe that Tomasz Grysztar has created the coff format just for fan If someone ever programmed with fasm coff format please help regards _________________ down under |
|||
27 Feb 2009, 10:54 |
|
revolution 27 Feb 2009, 11:07
habran wrote: LINK : error LNK2001 : unresolved external symbol "_start" Code: format coff ... entry _start public _start _start: ;your code starts here invoke ExitProcess,0 |
|||
27 Feb 2009, 11:07 |
|
vid 27 Feb 2009, 12:45
Oh yes, I forgot to mention you that when you disable default entry point with /NODEFAULTLIB, you also need to provide another entry point.
|
|||
27 Feb 2009, 12:45 |
|
habran 27 Feb 2009, 12:51
Thanks revolution,
now I have assembler error : entry _start error: illegal instruction |
|||
27 Feb 2009, 12:51 |
|
habran 27 Feb 2009, 13:00
Thanks vid,
LINK : error LNK2001 : unresolved external symbol "_start" |
|||
27 Feb 2009, 13:00 |
|
revolution 27 Feb 2009, 13:34
habran wrote: Thanks revolution, |
|||
27 Feb 2009, 13:34 |
|
habran 27 Feb 2009, 21:55
Still the same error:
LINK : error LNK2001 : unresolved external symbol "_start" _________________ down under |
|||
27 Feb 2009, 21:55 |
|
revolution 27 Feb 2009, 22:04
habran: I think it is time to post your fasm code. Else this might just keep going around in circles.
|
|||
27 Feb 2009, 22:04 |
|
habran 27 Feb 2009, 22:13
revolution here are the code:
_________________ down under |
|||||||||||
27 Feb 2009, 22:13 |
|
Yardman 28 Feb 2009, 05:03
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 03:26; edited 1 time in total |
|||
28 Feb 2009, 05:03 |
|
habran 28 Feb 2009, 05:31
Yardman, I have got the same result as before
I have no problem to link masm objects, I just want to see any fasm coff objects linked into exe now I have doubts that it is possible at all to do that I wish someone prove me wrong regards |
|||
28 Feb 2009, 05:31 |
|
revolution 28 Feb 2009, 05:36
habran wrote:
|
|||
28 Feb 2009, 05:36 |
|
sinsi 28 Feb 2009, 07:06
All I did was change "start" to "_start" in 2 places in your .asm file.
Code: C:\Users\me\Desktop\MSCOFF>\fasm\fasm MSCOFF.ASM flat assembler version 1.67.34 (961348 kilobytes memory) 3 passes, 277 bytes. C:\Users\me\Desktop\MSCOFF>link /subsystem:windows,4.0 /entry:start MSCOFF.OBJ \masm32\lib\user32.lib Microsoft (R) Incremental Linker Version 6.00.8168 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. C:\Users\me\Desktop\MSCOFF>dir Volume in drive C has no label. Volume Serial Number is 0FA6-3849 Directory of C:\Users\me\Desktop\MSCOFF 28/02/2009 05:28 PM <DIR> . 28/02/2009 05:28 PM <DIR> .. 27/02/2009 11:32 PM 571 makeit.bat 28/02/2009 05:27 PM 374 MSCOFF.ASM 28/02/2009 05:28 PM 16,384 MSCOFF.exe 28/02/2009 05:28 PM 277 MSCOFF.OBJ 27/02/2009 08:33 AM 925 MSCOFF.wap 15/02/2009 04:48 PM 69,632 pecvt.exe 6 File(s) 88,163 bytes 2 Dir(s) 153,521,668,096 bytes free C:\Users\me\Desktop\MSCOFF> Why do you use "pecvt"? There's no need afaict. |
|||
28 Feb 2009, 07:06 |
|
revolution 28 Feb 2009, 09:59
sinsi wrote: All I did was change "start" to "_start" in 2 places in your .asm file. |
|||
28 Feb 2009, 09:59 |
|
habran 28 Feb 2009, 10:58
Thanks everyone, I am happy that all of you got involved with this issue,
my goal was to test strap89's "pecvt" to create .obj file from .fas file first and then with linker create .pdb file for debugging with WinDbg, but unfortunately .obj file created this way is 'corrupted' so that linker can't create neither .pdb nor .exe, so if I link .o instead of .obj than it makes .exe and .pdb file but WinDbg doesn't have information about line numbers and can not debug source code conclusion: pecvt doesn't create proper .obj file I wish that someone can prove me wrong regards _________________ down under |
|||
28 Feb 2009, 10:58 |
|
vid 28 Feb 2009, 13:31
Quote: conclusion: pecvt doesn't create proper .obj file I quess it would be helpful for strap89 to upload the .obj file, so he can check whether it is really a problem in his tool, or your error. |
|||
28 Feb 2009, 13:31 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.