头文件代码:
class CDiskView : public CView
{
DECLARE_DYNCREATE(CDiskView)
private:
static COLORREF rgbColor[2];
static CString strType[];
void GetLabel(CString * str,double e,PCSTR strTail);
protected:
afx_msg void OnMemoryUpdate(CCmdUI *pCmdUI);
afx_msg void OnDiskUpdate(CCmdUI *pCmdUI);
virtual void OnDraw(CDC * pDC);
DECLARE_MAESSAGE_MAP();
};.cpp部分代码:
COLORREF CDiskView::rgbColor[2]={Mem_Color,Disk_Color};
CString CDiskView::strType[] = {"Memory","Fixed Disk","Remote Disk","RAM Disk"}; IMPLEMENT_DYNCREATE(CDiskView,CView)BEGIN_MESSAGE_MAP(CDiskView,CView)
ON_UPDATE_COMMAND_UI(ID_Memory,OnMemoryUpdate)
ON_UPDATE_COMMAND_UI_RANGE(IDM_Disk_C,IDM_Disk_E,OnDiskUpdate)
END_MESSAGE_MAP()
错误信息:
1.error C2509: '_GetBaseMessageMap' : member function not declared in 'CDiskView'
d:\测试各类用法程序\vc\diskpie\diskview.h(3) : see declaration of 'CDiskView'
2.error C2509: 'GetMessageMap' : member function not declared in 'CDiskView'
d:\测试各类用法程序\vc\diskpie\diskview.h(3) : see declaration of 'CDiskView'
3.warning C4273: 'protected: static struct AFX_MSGMAP const CView::messageMap' : inconsistent dll linkage. dllexport assumed.
4.error C2491: 'CDiskView::CView::messageMap' : definition of dllimport static data member not allowed
5.error C2248: 'OnMemoryUpdate' : cannot access protected member declared in class 'CDiskView'
6.error C2248: 'OnDiskUpdate' : cannot access protected member declared in class 'CDiskView'
class CDiskView : public CView
{
DECLARE_DYNCREATE(CDiskView)
private:
static COLORREF rgbColor[2];
static CString strType[];
void GetLabel(CString * str,double e,PCSTR strTail);
protected:
afx_msg void OnMemoryUpdate(CCmdUI *pCmdUI);
afx_msg void OnDiskUpdate(CCmdUI *pCmdUI);
virtual void OnDraw(CDC * pDC);
DECLARE_MAESSAGE_MAP();
};.cpp部分代码:
COLORREF CDiskView::rgbColor[2]={Mem_Color,Disk_Color};
CString CDiskView::strType[] = {"Memory","Fixed Disk","Remote Disk","RAM Disk"}; IMPLEMENT_DYNCREATE(CDiskView,CView)BEGIN_MESSAGE_MAP(CDiskView,CView)
ON_UPDATE_COMMAND_UI(ID_Memory,OnMemoryUpdate)
ON_UPDATE_COMMAND_UI_RANGE(IDM_Disk_C,IDM_Disk_E,OnDiskUpdate)
END_MESSAGE_MAP()
错误信息:
1.error C2509: '_GetBaseMessageMap' : member function not declared in 'CDiskView'
d:\测试各类用法程序\vc\diskpie\diskview.h(3) : see declaration of 'CDiskView'
2.error C2509: 'GetMessageMap' : member function not declared in 'CDiskView'
d:\测试各类用法程序\vc\diskpie\diskview.h(3) : see declaration of 'CDiskView'
3.warning C4273: 'protected: static struct AFX_MSGMAP const CView::messageMap' : inconsistent dll linkage. dllexport assumed.
4.error C2491: 'CDiskView::CView::messageMap' : definition of dllimport static data member not allowed
5.error C2248: 'OnMemoryUpdate' : cannot access protected member declared in class 'CDiskView'
6.error C2248: 'OnDiskUpdate' : cannot access protected member declared in class 'CDiskView'
解决方案 »
- 寻求WSAWaitForMultipleEvents 当第三个参数为TRUE时,如何?
- mfc 窗口透明的问题~~
- 谈谈你是怎么学习com的,小弟我最近看书看得很郁闷...
- list control 添加点击消息
- 程序退出时出错:after client block(#76) at 0x007......
- 关于report builer的问题,急!
- VC应用程序的"无标题"咋解决? 请教高手
- 对话框弹出之后为何原来对话框无法操作了?
- VC的扩展关键字__event,__hook,__unhook能实现跨进程事件调用吗?
- OnTimer不响应求助大神
- 有关于以服务方式启动程序 ,出现奇怪错误,请高手指教!!急!!!!
- 如何在CAsysncSocket的派生类中添加消息映呀!小弟很穷 只能放0分
和afx_msg void OnDiskUpdate(CCmdUI *pCmdUI);
拷贝到public下试试看
代码不是用向导生成的.
我也没用 GetBaseMessageMap,GetMessageMap 函数.
2、把你的“protected:”去掉吧
1.双击会跳到 BEGIN_MESSAGE_MAP() 行.
2.去掉"protected:",错误依旧.
他的定义与别的头文件中的定义没什么区别,别处没错,为什么这个文件就编译不过去呢?
ON_UPDATE_COMMAND_UI(ID_Memory,OnMemoryUpdate)
ON_UPDATE_COMMAND_UI_RANGE(IDM_Disk_C,IDM_Disk_E,OnDiskUpdate)
END_MESSAGE_MAP()把这些定义都放在 END_MESSAGE_MAP() 后面COLORREF CDiskView::rgbColor[2]={Mem_Color,Disk_Color};
CString CDiskView::strType[] = {"Memory","Fixed Disk","Remote Disk","RAM Disk"};
DECLARE_MESSAGE_MAP()