views:

133

answers:

1

Hi,

If I try to assemble the following code, I get a A2006 error ( error A2006: undefined symbol : StrCmp).

Here's my code:

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\masm32.inc
include  \masm32\include\user32.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\masm32.lib
includelib  \masm32\lib\stdlib.lib
includelib \masm32\lib\user32.lib

.data
YvanSoftware db "(c) YvanSoftware - ALL RIGHTS RESERVED", 13 ,10 ,0
EnterYourName db "Please enter your name: ", 0
CRLF db 13,10,0
TheHolyMan db "Yvan", 0
Seriously db "Seriously? You're the MAN!", 13,10,0
LoserName db "What a loser name.", 13,10

.data?
buffer db 100 dup(?)
.code
start:
 invoke StdOut,addr YvanSoftware
 invoke StdOut, addr EnterYourName
 invoke StdIn, addr buffer, 100
 invoke StdOut, addr CRLF

 invoke StrCmp,addr buffer, addr TheHolyMan ;error fires here
 je HolyMan
IfNotHolyMan: 
 invoke StdOut, addr LoserName
 jmp EndIfHolyMan
HolyMan:
 invoke StdOut, addr Seriously
 jmp EndIfHolyMan
EndIfHolyMan:

 invoke ExitProcess,0
END start

I'm a complete n00b at assembler, and I'm trying to learn it. ;)

Yvan

A: 

You do not mention any error on the invoke StdOut, so I assume this one assembles. In this case, the error should be exactly what it says: StrCmp is not recognized in the include files you listed. So just make sure one of your includes actually defines StrCmp (and since I don't remember what mode MASM defaults to, respect case sensitivy to be on the safe side).

Since You are using stdcall, your invoke will gen an external reference to something like _StrCmp@8 (@8 because there are two parms, each being 4 bytes). So you will also need to have this decorated name present in one of the includelib libs. This is not the problem you are seeing though, as this error is a masm one rather than a linker one.

filofel