Hello,

I'm just getting into ASM and whenever I try to compile anything with MASM i get this error:

Assembling: C:\Documents and Settings\Jon\Desktop\RadASM\Masm\Projects\ASMProject\ASMProject.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
ASMProject.exe : fatal error LNK1120: 1 unresolved externals

Make error(s) occured.

:o

By the way, the code I tried was...(maybe I did something wrong here?)



.386
.model flat,stdcall
.data

.data?

.const

.code

end


Thanks in advance for any help you can give. I'm running Windows XP SP1 by the way.
Posted on 2002-12-17 15:53:25 by kairon
the linker wants to create a executable which needs an entry point ...

in your code there is no entry point defined ...

.386


.model flat,stdcall

.data

.data?

.const

.code

myentry: ; here the program should start
nop ; some sort of expensive calculation ;)
ret

end myentry



ps: dont shoot me ... I'm not using assembly myself ... so the code is crappy I know ... but seems to work fine :grin:
Posted on 2002-12-17 16:07:04 by MerlinDMC
Hi guys.


MerlinDMC is correct. To give more details on this I would suggest following snippet.

Yes, linker wants an entry point hence we have to provide the entry point. So we follow the following way.

.386
.model flat, stdcall
option casemap:none

.data
; Your data
.data?
; your uninitialized data
.const
; any constant you want to use

.code
start: ;<--- this is the entry point of your program...
; the name of label can be any thing as long as the entry point and
; exit point is defined.


; Your code, ie what ever you like to use.

Procedure1 proc arg1:dword, arg2:dword.....


Procedure1 endp

; similarly we can define other procedure also. and forget to define the prototype of
; procedure in the begining of the file

end start ; <-- exit point of your program.

Use this and your problem will certainly vanishes.

regards
Posted on 2002-12-17 22:02:54 by processingspeed
A quick search at bring up this thread where exactly the same problems is described (only a few days ago)
Posted on 2002-12-18 00:54:25 by bazik
Thank you:)

one more thing, i have this error when compiling RC:

Using codepage 1252 as default
Creating rsrc.RES

RC: RCPP -CP 1252 -f C:\Documents and Settings\Jon\Desktop\RadASM\Masm\Projects\ASMProject\RCa01436 -g C:\Documents and Settings\Jon\Desktop\RadASM\Masm\Projects\ASMProject\RDa01436 -DRC_INVOKED -D_WIN32 -pc\:/ -E -I. -I .


RC : fatal error RC1110 : could not open rsrc.rc

Is this normal for code like this?(my other problem went away):



.386
.model flat,stdcall
.data

.data?

.const

.code
start:

end start;

end
Posted on 2002-12-18 05:28:59 by kairon
Where is your resource file?

And you dont need a semicolon after "end start"... that would cause a syntax error.
Posted on 2002-12-18 06:00:19 by bazik
And you dont need a semicolon after "end start"... that would cause a syntax error.


That must be someone doing too much of C or C++ codings. :grin:
Posted on 2002-12-18 07:45:52 by roticv