#include "StdAFX.h"
#include "mon.h"
#include "monDoc.h"
#include "monView.h"
#include "Mydatadialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//中间省略//
//.....................//
void CMonView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMydatadialog dlg;
dlg.m_radio_m=0;
dlg.m_edit_name="";
CString msg;
if(dlg.DoModal()==IDOK)
{msg="确定 按钮被按下!";}
else
{msg="取消 按钮被按下!";}
msg+="\r\n\n";
msg+="姓 名:";
msg+=dlg.m_edit_name;
msg+="\r\n";
msg+="性别:";
if(dlg.m_radio_m==0)
{msg+="男";}
else
{msg+="女";}
msg+="\r\n";
msg+="最高学历:";
msg+=dlg.m_combo_school;
msg+="\r\n";
msg+="爱好:";
if(dlg.m_check_art==true) {msg+="艺术 ";}
if(dlg.m_check_sport==true) {msg+="体育 ";}
if(dlg.m_check_music==true) {msg+="音乐";}
Afxmessagebox(msg); CView::OnLButtonDblClk(nFlags, point);
}
#include "mon.h"
#include "monDoc.h"
#include "monView.h"
#include "Mydatadialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//中间省略//
//.....................//
void CMonView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMydatadialog dlg;
dlg.m_radio_m=0;
dlg.m_edit_name="";
CString msg;
if(dlg.DoModal()==IDOK)
{msg="确定 按钮被按下!";}
else
{msg="取消 按钮被按下!";}
msg+="\r\n\n";
msg+="姓 名:";
msg+=dlg.m_edit_name;
msg+="\r\n";
msg+="性别:";
if(dlg.m_radio_m==0)
{msg+="男";}
else
{msg+="女";}
msg+="\r\n";
msg+="最高学历:";
msg+=dlg.m_combo_school;
msg+="\r\n";
msg+="爱好:";
if(dlg.m_check_art==true) {msg+="艺术 ";}
if(dlg.m_check_sport==true) {msg+="体育 ";}
if(dlg.m_check_music==true) {msg+="音乐";}
Afxmessagebox(msg); CView::OnLButtonDblClk(nFlags, point);
}
错误是
d:\mon\monview.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Debug/mon.pch': No such file or directory
D:\mon\monView.cpp(84) : error C2146: syntax error : missing ';' before identifier 'dlg'
D:\mon\monView.cpp(84) : error C2065: 'dlg' : undeclared identifier
D:\mon\monView.cpp(85) : error C2228: left of '.m_radio_m' must have class/struct/union type
D:\mon\monView.cpp(86) : error C2228: left of '.m_edit_name' must have class/struct/union type
D:\mon\monView.cpp(88) : error C2228: left of '.DoModal' must have class/struct/union type
D:\mon\monView.cpp(94) : error C2228: left of '.m_edit_name' must have class/struct/union type
D:\mon\monView.cpp(97) : error C2228: left of '.m_radio_m' must have class/struct/union type
D:\mon\monView.cpp(103) : error C2228: left of '.m_combo_school' must have class/struct/union type
D:\mon\monView.cpp(106) : error C2228: left of '.m_check_art' must have class/struct/union type
D:\mon\monView.cpp(107) : error C2228: left of '.m_check_sport' must have class/struct/union type
D:\mon\monView.cpp(108) : error C2228: left of '.m_check_music' must have class/struct/union type
Error executing cl.exe.monView.obj - 12 error(s), 0 warning(s)
{
// Construction
public:
Mydatadialog(CWnd* pParent = NULL); // standard constructor// Dialog Data
//{{AFX_DATA(Mydatadialog)
enum { IDD = IDD_DIALOG1 };
BOOL m_check_art;
BOOL m_check_music;
BOOL m_check_sport;
CString m_edit_name;
CString m_combo_school;
int m_radio_m;
//}}AFX_DATA
error C2065: 'CMydatadialog' : undeclared identifier
class Mydatadialog : public CDialog
在这里....
if(dlg.m_check_art==true) {msg+="艺术 ";}
if(dlg.m_check_sport==true) {msg+="体育 ";}
if(dlg.m_check_music==true) {msg+="音乐";}错误提示这样的
D:\mon\monView.cpp(106) : warning C4805: '==' : unsafe mix of type 'int' and type 'const bool' in operation
D:\mon\monView.cpp(107) : warning C4805: '==' : unsafe mix of type 'int' and type 'const bool' in operation
D:\mon\monView.cpp(108) : warning C4805: '==' : unsafe mix of type 'int' and type 'const bool' in operationmonView.obj - 0 error(s), 3 warning(s)为什么呢???
但我把"true"该成"TRUE" 就编译通过了
我觉得dlg.m_check_art是bool类型的,应该匹配啊! why?????