新建了一个MFC.EXE,单文档。命名为aaaa; 我要实现的功能,是隔2秒钟,用对话框弹出一组数据
在 aaaaView.h中,我添加了
#include <iostream>
#include <list>
using namespace std
#ifndef _STRUCTMSG_
#define _STRUCTMSG_
typedef struct Term
{
int coef;
float exponent;
}AA;
typedef list<Term> TermList;
TermList terms;
#endif //_STRUCTMSG_
在 aaaaView.cpp中,我添加了
TermList CAaaaView::Create()
{
AA term;
term.coef = 1;
term.exponent = 7.777;
terms.push_back(term);
term.coef = 2;
term.exponent = 8.8555;
terms.push_back(term);
term.coef = 3;
term.exponent = 9.94564;
terms.push_back(term);
return terms;
}
void CAaaaView::printout(TermList hu)
{
TermList::iterator pos;
CString str;
for( pos = hu.begin(); pos != hu.end(); ++pos)
{
SetTimer(1,2000,NULL);
str.Format("coef=%d,exponent=%f,size=%d",pos->coef,pos->exponent,hu.size());
pos = hu.erase(pos);
}
}
void CAaaaView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
printout(Create());
KillTimer(1);
CView::OnTimer(nIDEvent);
}
运行后出现错误:
error C2143: syntax error : missing ';' before '<class-head>'
fatal error C1004: unexpected end of file found
错误指向的是结构体定义的那里,
请大家教 我下,为什么出现在这种情况,我只是想调试一个定时器,初用定时器,请大家帮我看下,我要如何修改,谢谢