只要出现
BEGIN_MESSAGE_MAP(CWnd, CCmdTarget)
ON_COMMAND(CWndid, 0)
END_MESSAGE_MAP()就说
ON_COMMAND(CWndid, 0)处 error C2101: '&' on constant每个地方都是这样,怎么回事?如何解决?
BEGIN_MESSAGE_MAP(CWnd, CCmdTarget)
ON_COMMAND(CWndid, 0)
END_MESSAGE_MAP()就说
ON_COMMAND(CWndid, 0)处 error C2101: '&' on constant每个地方都是这样,怎么回事?如何解决?
解决方案 »
- 一个运用MAP 显示TreeCONTROL 的问题
- 基础问题,如何实现窗口停靠?
- 关于WinPcap开发文档中的pcap_live_dump例子的问题??
- GDI 和GDI+ 的问题!
- [紧急]如何访问类的成员函数?
- 2个问题,求教各位,我做毕设很急!!!!!!
- 关于文件格式,文本文件、二进制文件、执行文件的结尾标志?讨论!!!
- 帮忙看看:)
- 关于ListBox的问题,请大家帮帮忙,谢谢
- 自画控制
- 我的程序在Build后显示这个错误:unexpected end of file while looking for precompiled header directive什么原因?如何解决?Thanks!
- 请问这几个问题,一直以来对它的感觉都很模糊
是关于Message Mapping(消息映射)这节的
CMyWinApp::InitInstance
CFrameWnd::Create
CWnd::CreateEx
CFrameWnd::PreCreateWindow
CWinApp::Run
CWinThread::RunCMyView Message Map :
1221 CMyView
122 CView
12 CWnd
1 CCmdTargetCMyDoc Message Map :
131 CMyDoc
13 CDocument
1 CCmdTargetCMyFrameWnd Message Map :
1211 CMyFrameWnd
121 CFrameWnd
12 CWnd
1 CCmdTargetCMyWinApp Message Map :
1111 CMyWinApp
111 CWinApp
1 CCmdTarget
然后将frame7.03里的.h和.cpp文件复制到该目录下并添加到工程中
然后编译运行就出现了9个相同的错误,如下:
--------------------Configuration: Frame7 - Win32 Debug--------------------
Compiling...
MFC.cpp
e:\frame7\mfc.cpp(61) : error C2101: '&' on constant
e:\frame7\mfc.cpp(65) : error C2101: '&' on constant
e:\frame7\mfc.cpp(69) : error C2101: '&' on constant
e:\frame7\mfc.cpp(73) : error C2101: '&' on constant
e:\\frame7\mfc.cpp(77) : error C2101: '&' on constant
My.cpp
E:\Frame7\My.cpp(18) : error C2101: '&' on constant
E:\Frame7\My.cpp(22) : error C2101: '&' on constant
E:\Frame7\My.cpp(26) : error C2101: '&' on constant
E:\Frame7\My.cpp(30) : error C2101: '&' on constant
E:\Frame7\My.cpp(55) : warning C4018: '==' : signed/unsigned mismatch
Error executing cl.exe.Frame7.exe - 9 error(s), 1 warning(s)
你这样试一试:
直接打开my.cpp(main函数在这里面),然后编译该文件,环境会询问你该工程不存在是否要建立该工程,当然是了。这样应该没问题。
你的'&' on constant的错误很奇怪的,因为_messageEntries只是定义的静态而已。
试试我说的编译方法,不行的话(应该不会吧?),我把我编译的工程寄给你,你自己比较一下吧。
你把MFC.h的DECLARE_MESSAGE_MAP宏定义和BEGIN_MESSAGE_MAP宏定义贴出来看看?
{
AfxSig_end = 0, // [s end of message map]
AfxSig_vv,
};#define ON_COMMAND(id, memberFxn) \
{ WM_COMMAND, 0, (WORD)id, (WORD)id, AfxSig_vv, (AFX_PMSG)memberFxn },
试试