新手学习中问题,请大虾指教
在代码中:
class CSingleView : public CView
{
protected: // create from serialization only
CSingleView();
DECLARE_DYNCREATE(CSingleView)
// Attributes
public:
CSingleDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSingleView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
string str; virtual ~CSingleView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CSingleView)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
红字部分是自己添加的一个变量声明,其余代码是mfc框架生成的。
加上代码就报错:
error C2146: syntax error : missing ';' before identifier 'str'
error C2501: 'string' : missing storage-class or type specifiers
error C2501: 'str' : missing storage-class or type specifiers
本人刚在学习中,请赐教