錯誤信息:
Compiling...
mfc.cpp
D:\61\mfc7\mfc.cpp(61) : error C2101: '&' on constant
D:\61\mfc7\mfc.cpp(65) : error C2101: '&' on constant
D:\61\mfc7\mfc.cpp(69) : error C2101: '&' on constant
D:\61\mfc7\mfc.cpp(73) : error C2101: '&' on constant
D:\61\mfc7\mfc.cpp(77) : error C2101: '&' on constant
my.cpp
D:\61\mfc7\my.cpp(18) : error C2101: '&' on constant
D:\61\mfc7\my.cpp(22) : error C2101: '&' on constant
D:\61\mfc7\my.cpp(26) : error C2101: '&' on constant
D:\61\mfc7\my.cpp(30) : error C2101: '&' on constant
D:\61\mfc7\my.cpp(55) : warning C4018: '==' : signed/unsigned mismatch
Error executing cl.exe.
mfc7.exe - 9 error(s), 1 warning(s)
錯誤原因:
VC 6、5消息映射有不同。1)
修改 頭文件 Afxmsg_.h 中
#define ON_COMMAND(id, memberFxn) \
{ WM_COMMAND, CN_COMMAND, (WORD)id, (WORD)id, AfxSig_vv, (AFX_PMSG)memberFxn },
改 CN_COMMAND爲 0
並且
2)
修改 頭文件mfc.h中
// Message map signature values and macros in separate header
#include <afxmsg_.h>
爲
// Message map signature values and macros in separate header
#include "afxmsg_.h"
rebuild all