新手学习中问题,请大虾指教

firehan firehan 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在代码中:
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

本人刚在学习中,请赐教
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
firehan
VC/MFC 16,550 成员 421,606 内容