www.digitalmars.com         C & C++   DMDScript  

digitalmars.empire - error compiling winmain.d ?

reply Byron Smith <bsmith3 gt.rr.com> writes:
I get the following errors compiling empire 2.03 (for D) when it gets to 
winmain.d (I have no idea what to do about them):

Anyone here have the same problem? Are there any solutions? (Most likely 
I am doing something wrong...)

(Oh by the way, this is running make after it cleanly ran for everything 
before winmain with no errors...)

C:\EMPIRE~1>make
\dmd\bin\dmd -O -c winmain
winmain.d(397): function DialogBoxParamA (HANDLE 
hInstance,char*lpTemplateName,H
ANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
dwInitPara
m) does not match argument types (HANDLE,char[7],HANDLE,int(Windows 
*)(),int)
winmain.d(398): cannot implicitly convert expression *(#global + 44) of 
type int
(Windows *)() to int(Windows *)(HANDLE,uint,uint,int)
winmain.d(454): function DialogBoxParamA (HANDLE 
hInstance,char*lpTemplateName,H
ANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
dwInitPara
m) does not match argument types (HANDLE,char[8],HANDLE,int(Windows 
*)(),int)
winmain.d(455): cannot implicitly convert expression *(#global + 16) of 
type int
(Windows *)() to int(Windows *)(HANDLE,uint,uint,int)
winmain.d(1071): function DialogBoxParamA (HANDLE 
hInstance,char*lpTemplateName,
HANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
dwInitPar
am) does not match argument types (HANDLE,char[13],HANDLE,int(Windows 
*)(),int)
winmain.d(1071): cannot implicitly convert expression *(#global + 28) of 
type in
t(Windows *)() to int(Windows *)(HANDLE,uint,uint,int)

--- errorlevel 1
Aug 21 2004
parent reply Regan Heath <regan netwin.co.nz> writes:
Byron,

It appears Walter has been slack with his casting, the function call on 
line 397 looks like:

DialogBoxParamA(global.hinst, "InitBox", hwnd,
     global.lpfnInitDlgProc, 0);

which should read:

DialogBoxParamA(global.hinst, "InitBox", hwnd,
     cast(DLGPROC)global.lpfnInitDlgProc, 0);

The same goes for the others, here are the fixed versions:

line 454: DialogBoxParamA(global.hinst, "AboutBox", hwnd,
     cast(DLGPROC)global.lpfnAboutDlgProc, 0) ;

line 1071: DialogBoxParamA(global.hinst, "CitySelectBox", global.hwnd,
     cast(DLGPROC)global.lpfnCitySelectDlgProc, 0) ;

Regan

On Sat, 21 Aug 2004 20:58:07 -0500, Byron Smith <bsmith3 gt.rr.com> wrote:

 I get the following errors compiling empire 2.03 (for D) when it gets to 
 winmain.d (I have no idea what to do about them):

 Anyone here have the same problem? Are there any solutions? (Most likely 
 I am doing something wrong...)

 (Oh by the way, this is running make after it cleanly ran for everything 
 before winmain with no errors...)

 C:\EMPIRE~1>make
 \dmd\bin\dmd -O -c winmain
 winmain.d(397): function DialogBoxParamA (HANDLE 
 hInstance,char*lpTemplateName,H
 ANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
 dwInitPara
 m) does not match argument types (HANDLE,char[7],HANDLE,int(Windows 
 *)(),int)
 winmain.d(398): cannot implicitly convert expression *(#global + 44) of 
 type int
 (Windows *)() to int(Windows *)(HANDLE,uint,uint,int)
 winmain.d(454): function DialogBoxParamA (HANDLE 
 hInstance,char*lpTemplateName,H
 ANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
 dwInitPara
 m) does not match argument types (HANDLE,char[8],HANDLE,int(Windows 
 *)(),int)
 winmain.d(455): cannot implicitly convert expression *(#global + 16) of 
 type int
 (Windows *)() to int(Windows *)(HANDLE,uint,uint,int)
 winmain.d(1071): function DialogBoxParamA (HANDLE 
 hInstance,char*lpTemplateName,
 HANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
 dwInitPar
 am) does not match argument types (HANDLE,char[13],HANDLE,int(Windows 
 *)(),int)
 winmain.d(1071): cannot implicitly convert expression *(#global + 28) of 
 type in
 t(Windows *)() to int(Windows *)(HANDLE,uint,uint,int)

 --- errorlevel 1

-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Aug 22 2004
parent reply Byron Smith <bsmith3 gt.rr.com> writes:
Thanks! I am going to try it tomorrow... (gotta sleep and do the work 
thing...I'd rather get paid to stay home and play with Empire source 
code, though, if I had *MY* way).

Byron

Regan Heath wrote:
 Byron,
 
 It appears Walter has been slack with his casting, the function call on 
 line 397 looks like:
 
 DialogBoxParamA(global.hinst, "InitBox", hwnd,
     global.lpfnInitDlgProc, 0);
 
 which should read:
 
 DialogBoxParamA(global.hinst, "InitBox", hwnd,
     cast(DLGPROC)global.lpfnInitDlgProc, 0);
 
 The same goes for the others, here are the fixed versions:
 
 line 454: DialogBoxParamA(global.hinst, "AboutBox", hwnd,
     cast(DLGPROC)global.lpfnAboutDlgProc, 0) ;
 
 line 1071: DialogBoxParamA(global.hinst, "CitySelectBox", global.hwnd,
     cast(DLGPROC)global.lpfnCitySelectDlgProc, 0) ;
 
 Regan
 
 On Sat, 21 Aug 2004 20:58:07 -0500, Byron Smith <bsmith3 gt.rr.com> wrote:
 
 I get the following errors compiling empire 2.03 (for D) when it gets 
 to winmain.d (I have no idea what to do about them):

 Anyone here have the same problem? Are there any solutions? (Most 
 likely I am doing something wrong...)

 (Oh by the way, this is running make after it cleanly ran for 
 everything before winmain with no errors...)

 C:\EMPIRE~1>make
 \dmd\bin\dmd -O -c winmain
 winmain.d(397): function DialogBoxParamA (HANDLE 
 hInstance,char*lpTemplateName,H
 ANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
 dwInitPara
 m) does not match argument types (HANDLE,char[7],HANDLE,int(Windows 
 *)(),int)
 winmain.d(398): cannot implicitly convert expression *(#global + 44) 
 of type int
 (Windows *)() to int(Windows *)(HANDLE,uint,uint,int)
 winmain.d(454): function DialogBoxParamA (HANDLE 
 hInstance,char*lpTemplateName,H
 ANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
 dwInitPara
 m) does not match argument types (HANDLE,char[8],HANDLE,int(Windows 
 *)(),int)
 winmain.d(455): cannot implicitly convert expression *(#global + 16) 
 of type int
 (Windows *)() to int(Windows *)(HANDLE,uint,uint,int)
 winmain.d(1071): function DialogBoxParamA (HANDLE 
 hInstance,char*lpTemplateName,
 HANDLE hWndParent,int(Windows *lpDialogFunc)(HANDLE,uint,uint,int),int 
 dwInitPar
 am) does not match argument types (HANDLE,char[13],HANDLE,int(Windows 
 *)(),int)
 winmain.d(1071): cannot implicitly convert expression *(#global + 28) 
 of type in
 t(Windows *)() to int(Windows *)(HANDLE,uint,uint,int)

 --- errorlevel 1


Aug 22 2004
parent bsmith3 at gt dot rr dot com <bsmith3_member pathlink.com> writes:
OK... (a LONG time later)...

I finally got the Empire source code in D to compile... yay!!!

I had three problems, though:

First, was the casting bit that Regan so helpfully corrected for me (see copy of
his post below).

Second, I kept getting an error on not finding "va_list" in printf.d or
something like that. From reading dsource.org, I figured out I needed to include
the line "include std.stdarg;" in printf.d and all was well...until...

Third, make died on empire.rc because it couldn't find cursor.bmp or empire.ico.
I commented out the two lines because I have no idea where to get the files. So
I get an executable, but it's not really complete.

Am I supposed to have this much fun trying to compile something? I'm just a
newbie at all of this, and I almost couldn't figure it out.

Does anyone know of a better way to fix #2 and #3 than my solutions?

Is Walter going to update his empire D source code?

-- 
Byron

In article <cgbn8f$1o0l$1 digitaldaemon.com>, Byron Smith says...
Thanks! I am going to try it tomorrow... (gotta sleep and do the work 
thing...I'd rather get paid to stay home and play with Empire source 
code, though, if I had *MY* way).

Byron

Regan Heath wrote:
 Byron,
 
 It appears Walter has been slack with his casting, the function call on 
 line 397 looks like:
 
 DialogBoxParamA(global.hinst, "InitBox", hwnd,
     global.lpfnInitDlgProc, 0);
 
 which should read:
 
 DialogBoxParamA(global.hinst, "InitBox", hwnd,
     cast(DLGPROC)global.lpfnInitDlgProc, 0);
 
 The same goes for the others, here are the fixed versions:
 
 line 454: DialogBoxParamA(global.hinst, "AboutBox", hwnd,
     cast(DLGPROC)global.lpfnAboutDlgProc, 0) ;
 
 line 1071: DialogBoxParamA(global.hinst, "CitySelectBox", global.hwnd,
     cast(DLGPROC)global.lpfnCitySelectDlgProc, 0) ;
 
 Regan


Sep 24 2004