错误代码的链接为:http://www.clsoft.net/temp/hk/myprojects.rar这是我的代码:
BOOL dlg::OnInitDialog()
{
CDialog::OnInitDialog();MessageBox("主窗体被打开!");错误提示为:
}
--------------------Configuration: myprojects - Win32 Debug--------------------
Compiling...
dlg.cpp
F:\VC练习\myprojects\dlg.cpp(36) : error C2509: 'OnInitDialog' : member function not declared in 'dlg'
f:\vc练习\myprojects\dlg.h(13) : see declaration of 'dlg'
Error executing cl.exe.myprojects.exe - 1 error(s), 0 warning(s)
BOOL dlg::OnInitDialog()
{
CDialog::OnInitDialog();MessageBox("主窗体被打开!");错误提示为:
}
--------------------Configuration: myprojects - Win32 Debug--------------------
Compiling...
dlg.cpp
F:\VC练习\myprojects\dlg.cpp(36) : error C2509: 'OnInitDialog' : member function not declared in 'dlg'
f:\vc练习\myprojects\dlg.h(13) : see declaration of 'dlg'
Error executing cl.exe.myprojects.exe - 1 error(s), 0 warning(s)
// Implementation
protected: // Generated message map functions
//{{AFX_MSG(dlg)
virtual BOOL OnInitDialog();//加入该行即可
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
我的建议如下:
BOOL dlg::OnInitDialog()
{
MessageBox("主窗体被打开!");
return CDialog::OnInitDialog();
}
--------------------Configuration: myprojects - Win32 Debug--------------------
Compiling...
dlg.cpp
Generating Code...
Skipping... (no relevant changes detected)
myprojectsDlg.cpp
F:\VC练习\myprojects\dlg.cpp(40) : error C4716: 'dlg::OnInitDialog' : must return a value
Error executing cl.exe.myprojects.exe - 1 error(s), 0 warning(s)