BEGIN_MESSAGE_MAP(CControlCernterDlg,CDialog)
//{{AFX_MSG_MAP(CControlCernterDlg)
////////////////////////////////////////////
//***************中的错误
///////////////////////////////////////////
END_MESSAGE_MAP()
编译结果:
Compiling...
ControlCernterDlg.cpp
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2838: illegal qualified name in member declaration
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2059: syntax error : 'return '
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2238: unexpected token(s) preceding '; '
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2143: syntax error : missing '; ' before '* '
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2501: 'GetMessageMap ' : missing storage-class or type specifiers
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2556: 'int *__thiscall CControlCernterDlg::GetMessageMap(void) const ' : overloaded function differs only by return type from 'const struct AFX_MSGMAP *__thiscall
CControlCernterDlg::GetMessageMap(void) const '
d:/microsoft visual studio/myprojects/controlcernter/controlcernterdlg.h(47) : see declaration of 'GetMessageMap '
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2373: 'GetMessageMap ' : redefinition; different type modifiers
d:/microsoft visual studio/myprojects/controlcernter/controlcernterdlg.h(47) : see declaration of 'GetMessageMap '
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2143: syntax error : missing '; ' before 'tag::id '
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2734: 'AFX_MSGMAP ' : const object must be initialized if not extern
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : error C2371: 'AFX_MSGMAP ' : redefinition; different basic types
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : see declaration of 'AFX_MSGMAP '
D:/Microsoft Visual Studio/MyProjects/ControlCernter/ControlCernterDlg.cpp(39) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
ControlCernter.exe - 11 error(s), 0 warning(s)
解决方法是:检查自己在源文件中的函数实现过程的先后顺序是不是搞错了
我开始的时候认为是他们中间有错误
void ***::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(***)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(***, CDialog)
//{{AFX_MSG_MAP(***)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
可是看过多遍发现无误!
就从文件实现中:
构造函数
往下看
///////////////////////////////
结果是把
void ***::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(***)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(***, CDialog)
//{{AFX_MSG_MAP(***)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
给放到了初始化后面了。
顺序错了。
此种错误是犹豫个人多粗心大意!
在VC 6.0中函数的实现部分是分先后的,好像是在钱能老师的书中读到过,开始就想着要避免这种错误!
可是没有遇到过,今天中算是明白了!