I have this piece of code:
static char szTop[] = "iMsg wParam lParam";
static char szUnd[] = "____ ______ ______";
static char szFormat[] = "%-16s%04X-%04X %04X-%04X";
static char szBuffer[50];
static HWND hwndButton[NUM];
And it gives me error :
error C2143: syntax error : missing ']' before ';'
error C2143: syntax error : missing ';' before ']'
Another code is:
for(i=0;i<NUM;i++)
hwndButton[i] = CreateWindow ( "button", button[i].text, WS_CHILD | WS_VISIBLE | button[i].style, cxChar, cyChar * (1+2*i), 20*cxChar, 7*cyChar/4, hwnd, (HMENU) i, ((LPCREATESTRUCT) lParam )->hInstance, NULL );
return 0;
And this gives me error:
error C2146: syntax error : missing ')' before identifier 'i'
error C2059: syntax error : ';'
error C2059: syntax error : ')'
error C2146: syntax error : missing ';' before identifier 'hwndButton
I have defined the required things previously as:
static char szTop[] = "iMsg wParam lParam";
static char szUnd[] = "____ ______ ______";
static char szFormat[] = "%-16s%04X-%04X %04X-%04X";
static char szBuffer[50];
static HWND hwndButton[NUM];
static RECT rect;
static int cxChar,cyChar;
HDC hdc;
PAINTSTRUCT ps;
int i;
TEXTMETRIC tm;
For that first one, this can be caused by not having a definition in place for a type or macro, most likely
HWNDorNUM.For the second one, it’s complaining about the use of
hwndButtonbefore defining it, simply because of the first error – that variable was never defined because the statement that tried to define it had that earlier error error.First, verify that you have included the correct headers. I think it’s in
windef.hbut is usually included by thewindows.hheader file.Second, ensure that
NUMis actually defined somewhere.I think it’s probably the
NUMone simply because one of the errors comes from theforloop statement, wherewindows.hstuff is not used butNUMis.