Original Post
Hello,
I feel pretty stupid to post again a topic about a build-error (vc++ 6) but I fail to solve this problem alone. I''ve no idea what''s wrong with the code the errors refer to.
CText is a class that makes use of templates. This is not the only code in my program that makes use of templates but of this code I get no errors. I would be very greatful if someone can help me with this problem.
Merwin
/*
this are the build-errors I get:
main.cpp
d:\cpp\class\main.cpp(198) : error C2143: syntax error : missing '')'' before '';''
d:\cpp\class\main.cpp(198) : error C2059: syntax error : '')''
d:\cpp\class\main.cpp(199) : error C2143: syntax error : missing '')'' before '';''
d:\cpp\class\main.cpp(199) : error C2059: syntax error : '')''
*/
// this are line 198 and 199 of main.cpp
g_txtNumbers.LoadFont("numbers.bmp", f_LoadDesc, CT_NUMBERS);
g_txtMenu.LoadFont("menutext.bmp", f_LoadDesc, CT_TEXT);
/*
this are the build-errors I get:
d:\cpp\class\text.h(87) : warning C4018: ''<'' : signed/unsigned mismatch
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(89) : error C2143: syntax error : missing '')'' before '';''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(89) : error C2059: syntax error : '')''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(90) : warning C4390: '';'' : empty controlled statement found; is this the intent?
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(91) : error C2143: syntax error : missing '')'' before '';''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(91) : error C2059: syntax error : '')''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(91) : warning C4390: '';'' : empty controlled statement found; is this the intent?
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(95) : error C2143: syntax error : missing '')'' before '';''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(95) : error C2059: syntax error : '')''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(95) : warning C4390: '';'' : empty controlled statement found; is this the intent?
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(101) : error C2143: syntax error : missing '';'' before ''if''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(101) : error C2143: syntax error : missing '')'' before '';''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(101) : error C2059: syntax error : '')''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(101) : warning C4390: '';'' : empty controlled statement found; is this the intent?
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(104) : error C2143: syntax error : missing '')'' before '';''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(104) : error C2059: syntax error : '')''
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
d:\cpp\class\text.h(104) : warning C4390: '';'' : empty controlled statement found; is this the intent?
d:\cpp\class\text.h(81) : while compiling class-template member function ''int __thiscall CText<char>::DrawTextA(char *,struct IDirectDrawSurface4 *,int,int)''
Error executing cl.exe.
*/
/* this is the function where all the build-errors refer to.
Comment in this function is in dutch but isn''t really important for this problem
*/
BOOL DrawText(char *text, LPDIRECTDRAWSURFACE4 lpdds, int x, int y){
BOOL ok;
// waarde van het aantal pixels dat op dat moment horizontaal getekend is
int f_iWidthCurDraw=0;
int f_nr=0;
for(int i=0; i<strlen(text); i++){
if(text[i]>=''0'' && text[i]<=''9'' && m_dwFLAGS & CT_NUMBERS)
f_nr=text[i]-''0'';
if(text[i]>=''a'' && text[i]<=''z'' && m_dwFLAGS & CT_TEXT){
f_nr=text[i]-''a'';
// de nummmers komen voor de letters
if(m_dwFLAGS & CT_NUMBERS) f_nr+=10;
}
if(text[i]>=''A'' && text[i]<=''Z''){
f_nr=text[i]-''A''
// tel er 26 bij op omdat de kleine letters eerst komen
if(m_dwFLAGS & CT_DISTINGUISHCAPITALS) f_nr+=26;
// de nummmers komen voor de letters
if(m_dwFLAGS & CT_NUMBERS) f_nr+=10;
}
// teken de waarde van text[f_nr]
m_lpTextImages[f_nr].Draw(lpdds, x+f_iWidthCurDraw, y);
f_iWidthCurDraw += m_lpTextImages[f_nr].m_dwWidthPixels;
}
}