急vs2008 MFC类下定义编辑框对象出错,后改为全局变量又可以,是为什么啊该如何解决
急!vs2008 MFC类下定义编辑框对象出错,后改为全局变量又可以,是为什么啊。。。急!
参考代码如下:
#pragma once
#include "KeyEdit.h"
class CCustomGrid : public CListCtrl
{
DECLARE_DYNAMIC(CCustomGrid)
public:
CCustomGrid();
CKeyEdit edit;//出错行
bool showedit;
int row;
int col;
virtual ~CCustomGrid();
protected:
DECLARE_MESSAGE_MAP()
virtual void PreSubclassWindow();
public:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
void ShowEdit(void);
};
错误提示:
1>e:\c++exercise\图书馆理系统\图书馆理系统\customgrid.h(10) : error C2146: 语法错误 : 缺少“;”(在标识符“edit”的前面)
希望能得到大家的帮助!
------解决方案--------------------
KeyEdit.h
这个文件中的代码贴上来看看
------解决方案--------------------
头文件互包含了 把#include "CustomGrid.h"去掉
------解决方案--------------------
1、头文件不能相互包含
2、用前置声明的方式可以解决这个问题既,在CKeyEdit类的头文件中用class CCustomGird;做前置声明,在CKeyEdit类的实现文件里加#include "CustomGrid.h"
------解决方案--------------------
1、头文件不能相互包含
2、用前置声明的方式可以解决这个问题既,在CKeyEdit类的头文件中用class CCustomGird;做前置声明,在CKeyEdit类的实现文件里加#include "CustomGrid.h"
------解决方案--------------------
头文件不能互包含这句好像有问题吧
参考代码如下:
#pragma once
#include "KeyEdit.h"
class CCustomGrid : public CListCtrl
{
DECLARE_DYNAMIC(CCustomGrid)
public:
CCustomGrid();
CKeyEdit edit;//出错行
bool showedit;
int row;
int col;
virtual ~CCustomGrid();
protected:
DECLARE_MESSAGE_MAP()
virtual void PreSubclassWindow();
public:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
void ShowEdit(void);
};
错误提示:
1>e:\c++exercise\图书馆理系统\图书馆理系统\customgrid.h(10) : error C2146: 语法错误 : 缺少“;”(在标识符“edit”的前面)
希望能得到大家的帮助!
------解决方案--------------------
KeyEdit.h
这个文件中的代码贴上来看看
------解决方案--------------------
头文件互包含了 把#include "CustomGrid.h"去掉
------解决方案--------------------
1、头文件不能相互包含
2、用前置声明的方式可以解决这个问题既,在CKeyEdit类的头文件中用class CCustomGird;做前置声明,在CKeyEdit类的实现文件里加#include "CustomGrid.h"
------解决方案--------------------
1、头文件不能相互包含
2、用前置声明的方式可以解决这个问题既,在CKeyEdit类的头文件中用class CCustomGird;做前置声明,在CKeyEdit类的实现文件里加#include "CustomGrid.h"
------解决方案--------------------
头文件不能互包含这句好像有问题吧