小问题编译不过来请帮忙(在线等)——编译不通过!~

mon505 2005-10-13 11:21:15
#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);
}
...全文
336 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
mon505 2005-10-14
  • 打赏
  • 举报
回复
各位还有啊 有3个warning 啊
在这里....
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 operation

monView.obj - 0 error(s), 3 warning(s)

为什么呢???
但我把"true"该成"TRUE" 就编译通过了
我觉得dlg.m_check_art是bool类型的,应该匹配啊! why?????
mon505 2005-10-14
  • 打赏
  • 举报
回复

明白了
我平时写类的习惯不好
我是新手 小问题也看不出来啊 !~~~ 谢谢各位啦~~
去调试能通过不。
菜牛 2005-10-14
  • 打赏
  • 举报
回复
CMydatadialog dlg;
error C2065: 'CMydatadialog' : undeclared identifier
class Mydatadialog : public CDialog
hugwind 2005-10-14
  • 打赏
  • 举报
回复
是CMydatadialog还是Mydatadialog
mon505 2005-10-14
  • 打赏
  • 举报
回复
在头文件Mydatadialog.h是这样定义的

class Mydatadialog : public CDialog
{
// 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
mon505 2005-10-14
  • 打赏
  • 举报
回复

原来这样
0黄瓜0 2005-10-14
  • 打赏
  • 举报
回复
BOOL类型实际上是int,和C++的bool类型还是有点区别的.
mon505 2005-10-13
  • 打赏
  • 举报
回复
我插入了一个对话框Mydatadialog 头文件都加进去了 但是还是有错啊

D:\mon\monView.cpp(84) : error C2065: 'CMydatadialog' : undeclared identifier
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)
菜牛 2005-10-13
  • 打赏
  • 举报
回复
Afxmessagebox

AfxMessageBox

没有具体错误信息?
mon505 2005-10-13
  • 打赏
  • 举报
回复
忘记说了!~~
错误是
d:\mon\monview.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Debug/mon.pch': No such file or directory

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧