I removed the comment from the Console sample for the "Invoke ClearScreen"

Get_Input Msg1, inbuf
Invoke ReverseText,Offset inbuf,Offset textbuf2
Invoke Ucase,Offset textbuf2
Invoke ClearScreen
Print_Text Msg2
Print_Text inbuf

Doing so produce a linker error

masm32.lib(CLEARSCR.obj) : error LNK2001: unresolved external symbol _wsprintfA

I suspect there is something improperly build in the library, but what?
The source code for ClearScreen does not directly call _wsprintfA

Posted on 2004-04-29 05:21:31 by thierry
There is a problem with hutch--'s MASM32. He declares wsprintf both in user32.inc and windows.inc, which means this function will be needed even if you don't call it. Either add user32.lib to the linker commandline, to your "includelib" statements, or fix windows.inc and remove the wsprintf related things.
Posted on 2004-04-29 06:52:40 by f0dder
Thanks for the tip.

I added the user32.LIb using IncludeLib.

It creates the executable, which is doing what i expected, but the linker gives me an other error.
LINK : warning LNK4089: all references to "user32.dll" discarded by /OPT:REF

I do not receive this error when compiling/linking directly from MASM32.

I searched around in the options, but could not find where this option is set.

Sorry if my questions seems silly, but i am a newbie both with MASM32 and WinAsm.

Thierry :confused:
Posted on 2004-05-02 15:04:16 by thierry
You get a warning, not an error. This warning tells you that "hey, I see that you are mentioning a symbol from user32.dll, but you're not using it!". You are "mentioning" the wsprintf function because of the bug with the MASM32 includes - you should delete the wsprintf related stuff from the WINDOWS.INC file and keep it in USER32.INC .

hutch-- proposes that you "fix" this by using /OPT:NOREF on the linker commandline, but this causes your programs to *always* import user32.dll, no matter if you use it or not. I say it's better to either ignore the warning message, or go and fix the problem.

Fixing the problem is easy, you open WINDOWS.INC in a text editor and search for wsprintf. You should see something like:

wsprintf equ <wsprintfA>

Delete those two lines and presto, the warning is gone. The definition is also done in USER32.INC, where it belongs. Hutch refuses to fix this bug in the official distribution, because I told him about it :rolleyes:
Posted on 2004-05-02 15:30:05 by f0dder
Thanks for your help.
It's working fine now.:alright:
Posted on 2004-05-03 01:14:04 by thierry
Glad to have helped :)
Posted on 2004-05-03 03:15:33 by f0dder