I know that wasn't a problem until a few days ago which then I only installed the SDK DX9 and Scronty's DX includes. I know this can't be the problem. Unless the SDK install screwed up my windows.inc file which I doubt.

but however when I use wsprintf in an app I get the below error


Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

Assembling: C:\masm32\work\calc2.asm
C:\masm32\work\calc2.asm(21) : error A2111: conflicting parameter definition
_
Assembly Error
Press any key to continue . . .


What could be causing this problem or if anyone has experience something similar plz advise on how I can fix it. I 've tried commenting it out of windows.inc and/or source file didn't help any. And there isn't any typos in either files.
The below code compile fine awhile back but now it won't .


;Feb. 24, 2003
;project: calc2.asm, calculate values
;author: Tweak aka Patrick Pippen

.386
.model flat, stdcall
option casemap:none

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


includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

wsprintfA PROTO C :DWORD,:VARARG
wsprintf equ <wsprintfA>

.data
titlestring db "Result of calculation:",0
formatstring db "The result is: %s and the remainder is %s!",0
completestring db 50 dup(0)
buff_for_result db 10 dup(0)
buff_for_remainder db 10 dup(0)
szformat db "%u",0
.data?

.code

start:
mov eax,10 ;# to multiply with # in ecx
mov ecx,7 ; this is the multiplier
mul ecx
adc eax,62 ;add with carry 62 to result in eax
xor edx,edx ;set edx to 0
xor ecx,ecx
mov ecx,2
div ecx
invoke wsprintf,ADDR buff_for_result,ADDR szformat,eax
invoke wsprintf,ADDR buff_for_remainder,ADDR szformat,edx ;the remainder is in edx
invoke wsprintf,ADDR completestring,ADDR formatstring,ADDR buff_for_result,ADDR buff_for_remainder
invoke MessageBox,0,ADDR completestring,ADDR titlestring,MB_OK
invoke ExitProcess,0
end start
Posted on 2003-12-28 21:31:11 by Tweak
I think that Windows.inc has wsprintf defined in it, that is probably where you are getting a conflicting parameter. MASM32 defines it as a STD_CALL function and corrects the stack, if you try to change it to a C function it will throw an error, and anyway you didn't bother to correct the stack when you called it, that would lead to stack errors when you ran the program.

Actually I should have checked, it is defined as a C function in MASM32. I don't get an error when I assemble the program.
Posted on 2003-12-28 22:33:45 by donkey
wsprintfA PROTO C :DWORD,:VARARG
wsprintf equ <wsprintfA>

is defined in windows.inc I know and at first I thought this was were I was getting confliicting parameters from. So I remove the above from source file and got

Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

Assembling: C:\masm32\work\calc2.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

calc2.obj : error LNK2001: unresolved external symbol _wsprintfA
calc2.exe : fatal error LNK1120: 1 unresolved externals
_
Link error
Press any key to continue . . .

then I tried different combos of leaving one thing an not the another. plz tell what U did to get it compile like I said I think something is wrong with my linker . That app compile fine months ago now whenever I use wsprintf in an app I get errors about it.
Posted on 2003-12-29 09:41:21 by Tweak
That is extremely weird. I have been using wsprintf for as long as I could recall, but I never got such errors. Hmm.

Could you check if it (wsprintf) is defined anywhere and paste the relevant codes?
Posted on 2003-12-29 09:53:03 by roticv

That is extremely weird. I have been using wsprintf for as long as I could recall, but I never got such errors. Hmm.

Could you check if it (wsprintf) is defined anywhere and paste the relevant codes?


In windows.inc
wsprintfA PROTO C :DWORD,:DWORD,:VARARG
wsprintf equ <wsprintfA>
also in debug.inc
invoke wsprintf, addr szDebugNum, CTEXT("%li"), dwNum

I check every file in c:\masm32\include and that the only place where wsprintf was ever mention.
Posted on 2003-12-29 11:24:07 by Tweak
Hi tweak,

Maybe a bad lib file, try to rebuild user32.lib using inc2l user32.inc and copy the new user32.lib to your lib folder.
Posted on 2003-12-29 11:28:42 by donkey
hmmz, the last post has two dwords then vararg, the earlier one has ONE dword then vararg, and I believe the last posted one is accurate since the params are ptr to buffer, ptr to format string, args for format string..
I've never had issues with using it myself, I just thought I'd point out that discrepancy :)
Posted on 2003-12-29 11:30:15 by Homer
You got it EvilHomer2K:

http://www.asmcommunity.net/board/index.php?topic=5620

I thought I had seen this before.
Posted on 2003-12-29 11:36:22 by donkey

Hi tweak,

Maybe a bad lib file, try to rebuild user32.lib using inc2l user32.inc and copy the new user32.lib to your lib folder.


Hey, donkey you were right my user32.inc had that in it.

wvsprintfA PROTO :DWORD,:DWORD,:DWORD
wvsprintf equ <wvsprintfA>


Which should have been.
wsprintfA PROTO :DWORD,:DWORD,:VARARG
wsprintf equ <wsprintfA>

now the calc2.asm complies without a problem thanks :alright:

Still :notsure: what could have cause this !! Since it work and compiled fine before.
Posted on 2003-12-29 12:15:03 by Tweak
wvsprintfA is a different function than wsprintfA, note the v. The lib file was corrupted in some way probably, who knows how, it could be for any number of reasons. Sometimes it's because of growing bad sectors on a disk hitting that file (they do grow sometimes). It is true however that the proto is different in User32.inc than everywhere else but because it is VARARG it should not make a difference as the DWORD parameters just tell the compiler the number of required parameters in a C calling convention proto.
Posted on 2003-12-29 13:00:53 by donkey
Hello All:
I had a similar problem with Iczelion #24 and Donkey gave this reply on Hutch's board:

"Posted: Sun May 25, 2003 9:58 pm Post subject:

--------------------------------------------------------------------------------

The VARARG will accomodate the extra DWORD. In essence it tells the assembler that you do not know the number of arguments that will be passed. "


Hutch also replied:

Posted: Mon May 26, 2003 2:45 am Post subject:

--------------------------------------------------------------------------------

Fumio,

in version 8 the API is defined in user32.inc as follows,
Code:

wsprintfA PROTO C :DWORD,:VARARG
wsprintf equ <wsprintfA>


The best thing to do is remove it from Iczelion's tutorial as you will get redefinition errors if they are declared differently.
_________________
Regards,


This solved my problem
Fumio
Posted on 2003-12-30 15:13:49 by Fumio