在MFC中用struct数组 赋值报错 啊该如何解决

在MFC中用struct数组 赋值报错 啊
#define NUM 2
struct array
{
unsigned long sum;
int flag;
}all[NUM];

for (int lp=0; lp<NUM; lp++)
{
all[lp].flag=0;
all[lp].sum=0;
}

这个是在mfc中用的 报错为 就是for循环这部分的错误
.cpp(24) : error C2143: syntax error : missing ';' before 'for'
.cpp(24) : error C2143: syntax error : missing ')' before ';'
.cpp(24) : error C2143: syntax error : missing ';' before '<'
.cpp(24) : error C2501: 'lp' : missing storage-class or type specifiers
.cpp(24) : error C2143: syntax error : missing ';' before '<'
.cpp(24) : error C2143: syntax error : missing ';' before '++'
.cpp(24) : error C2501: 'lp' : missing storage-class or type specifiers
.cpp(24) : error C2086: 'lp' : redefinition
.cpp(24) : error C2143: syntax error : missing ';' before '++'
.cpp(24) : error C2059: syntax error : ')'
.cpp(25) : error C2143: syntax error : missing ';' before '{'
.cpp(25) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.

------解决方案--------------------
你这for循环写在哪了,放到个函数或者main里面吧。。。