我用mfc 编写单文档程序,可以切分成3个窗口,每个窗口实现不同的功能,分别可以显示目录,做浏览器,字编辑,现在编译出错,有这样的提示:
d:\microsoft visual studio\msdev98\myprojects\myprog\myprogview.h(22) : error C2143: syntax error : missing ';' before '*'
d:\microsoft visual studio\msdev98\myprojects\myprog\myprogview.h(22) : error C2501: 'CMyProgDoc' : missing storage-class or type specifiers
d:\microsoft visual studio\msdev98\myprojects\myprog\myprogview.h(22) : error C2501: 'GetDocument' : missing storage-class or type specifiers
Generating Code...
源码:
class CMyProgView : public CEditView
{
protected: // create from serialization only
CMyProgView();
DECLARE_DYNCREATE(CMyProgView)// Attributes
public:
CMyProgDoc* GetDocument();
// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyProgView)
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 源码好象不会有问题的 不知为何总是出错?
d:\microsoft visual studio\msdev98\myprojects\myprog\myprogview.h(22) : error C2143: syntax error : missing ';' before '*'
d:\microsoft visual studio\msdev98\myprojects\myprog\myprogview.h(22) : error C2501: 'CMyProgDoc' : missing storage-class or type specifiers
d:\microsoft visual studio\msdev98\myprojects\myprog\myprogview.h(22) : error C2501: 'GetDocument' : missing storage-class or type specifiers
Generating Code...
源码:
class CMyProgView : public CEditView
{
protected: // create from serialization only
CMyProgView();
DECLARE_DYNCREATE(CMyProgView)// Attributes
public:
CMyProgDoc* GetDocument();
// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyProgView)
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 源码好象不会有问题的 不知为何总是出错?
你肯定在头文件里声明是有问题了,
在"MyProgView.h"里包含"MyProgViewdoc.h"这个文件试试
class CMyProgView : public CEditView
{
protected: // create from serialization only
CMyProgView();
........