编译器是:vc6
我自定义了一个类:class CGridView : public CScrollView
在想在这个类中调用CMainFrame类:
我在自定义类中:#include "MainFrm.h"
也定义了:CMainFrame* m_lpMainWnd;
但编译是任然出错:
1 syntax error : missing ';' before '*'
2 'CMainFrame' : missing storage-class or type specifiers
3 'm_lpMainWnd' : missing storage-class or type specifiers
请问这是为什么?
这个错不是因为头文件没定义导致的吗?
我自定义了一个类:class CGridView : public CScrollView
在想在这个类中调用CMainFrame类:
我在自定义类中:#include "MainFrm.h"
也定义了:CMainFrame* m_lpMainWnd;
但编译是任然出错:
1 syntax error : missing ';' before '*'
2 'CMainFrame' : missing storage-class or type specifiers
3 'm_lpMainWnd' : missing storage-class or type specifiers
请问这是为什么?
这个错不是因为头文件没定义导致的吗?
#pragma comment(lib,"Msimg32.lib")
/////////////////////////////////////////////////////////////////////////////
// CGridView view#define CELLSIZE 80//一个网格占80*80个像素
#define ROWCELLCOUNT 10 //网格中一行10个格子class CGridView : public CScrollView
{
protected:
CGridView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CGridView)public:
CMainFrame* m_lpMainWnd;
HPEN m_hGridPen;//网格线
HBRUSH m_hFocusBrush;//填充画刷
BITMAPINFO* m_lpBitmapInfo;};这是头文件定义 vc6 一直报错 但我认为应该没错误的。我已经看了好几个小时不知错在哪了。请大家帮忙看一下,这个错误不解决 我无法做下去了。
#include "MainFrm.h"
#pragma comment(lib,"Msimg32.lib")
/////////////////////////////////////////////////////////////////////////////
// CGridView view#define CELLSIZE 80//一个网格占80*80个像素
#define ROWCELLCOUNT 10 //网格中一行10个格子class CGridView : public CScrollView
{
//这也是mfc生成的
protected:
CGridView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CGridView)//省略了mfc生成的代码
........//以下是自己定义的变量,报错是:CMainFrame* m_lpMainWnd;这一行 但我真不知道怎么会报错 头文件我也包含了
public:
CMainFrame* m_lpMainWnd;
HPEN m_hGridPen;//网格线
HBRUSH m_hFocusBrush;//填充画刷
BITMAPINFO* m_lpBitmapInfo;
};
"MainFrm.h"
里有没有:
CMainFrame ?
是不是改过了?
在调用的时候用AfxGetMainFrame()