VS小白学习MFC建立简单的学生信息系统未定义标识符

qkq666 2016-02-19 03:29:18
如题,小白试着按照教程制作,遇到未定义标识符的困境,望技术大牛给予点播:

this->GetDlgItem(StudentName)->GetWindowTextW(m_StudentName);
m_stStudent[g_icount].m_Name = m_StudentName;
if (this->GetCheckedRadioButton(GenderMale, GenderFemale) == GenderMale)
其中StudentName,m_stStudent,GenderMale,GenderFemale未定义标识符
请问如何解决
...全文
453 45 打赏 收藏 转发到动态 举报
写回复
用AI写文章
45 条回复
切换为时间正序
请发表友善的回复…
发表回复
schlafenhamster 2016-02-25
  • 打赏
  • 举报
回复
“按照《数字图像处理基础及OpenCV实现》2.4章节演示步骤操作的,” 找 源代码 。 “演示步骤” 是给你看的,
qkq666 2016-02-24
  • 打赏
  • 举报
回复
引用 41 楼 schlafenhamster 的回复:
那哪里来的 CStudentManagerNewDlg::OnBnClickedOK() ?? CStudentManagerDlg 还是 CStudentManagerNewDlg
是StudentManagerNewDlg.cpp文件里用到的m_Student具体出现在 void CStudentManagerNewDlg::OnBnClickedOk() { // TODO: 在此添加控件通知处理程序代码 this->GetDlgItem(StudentName)->GetWindowTextW(m_StudentName); m_Student[g_icount].m_Name = m_StudentName; if (this->GetCheckedRadioButton(GenderMale, GenderFemale) == GenderMale) m_Student[g_icount].m_Gender = "男"; else m_Student[g_icount].m_Gender = "女"; this->GetDlgItem(StudentClass)->GetWindowTextW(m_StudentClass); m_Student[g_icount].m_Class = m_StudentClass; this->GetDlgItem(StudentPhone)->GetWindowTextW(m_StudentPhone); m_Student[g_icount].m_Phone = m_StudentPhone; if (m_IsLeader.GetCheck()) m_Student[g_icount].m_IsLeader = "是"; else m_Student[g_icount].m_IsLeader = "否"; m_ListBox.AddString(m_StudentName); g_icount++; CDialogEx::OnOK(); }
qkq666 2016-02-24
  • 打赏
  • 举报
回复
引用 42 楼 lx624909677 的回复:
[quote=引用 35 楼 qkq666 的回复:] [quote=引用 34 楼 lx624909677 的回复:] [quote=引用 32 楼 qkq666 的回复:] [quote=引用 31 楼 lx624909677 的回复:] 不要看那个红字,先编译下,看看编译能过不,那个错误的提示有时会有“延迟”
恩恩,是会有延迟的,之前的几个红字的再打开就通过了,但是m_stStudent这个过不去,编译的话失败。[/quote] 编译结果中,显示的这个错误具体是什么?[/quote] 未定义[/quote] 那就看下这个变量对应的类在哪儿,点击类名按F12看看,还有就是仔细检查类名[/quote] 按照《数字图像处理基础及OpenCV实现》2.4章节演示步骤操作的,保证他出现的都写了,但是不知道问题出在哪,应该是缺少什么东西,或许就是类的定义,小白表示找不到啊,也不知道在哪补充相应代码
qkq666 2016-02-23
  • 打赏
  • 举报
回复
引用 34 楼 lx624909677 的回复:
[quote=引用 32 楼 qkq666 的回复:] [quote=引用 31 楼 lx624909677 的回复:] 不要看那个红字,先编译下,看看编译能过不,那个错误的提示有时会有“延迟”
恩恩,是会有延迟的,之前的几个红字的再打开就通过了,但是m_stStudent这个过不去,编译的话失败。[/quote] 编译结果中,显示的这个错误具体是什么?[/quote] 未定义
qkq666 2016-02-23
  • 打赏
  • 举报
回复
引用 33 楼 schlafenhamster 的回复:
越说越 乱 把 StudentManagerDlg.h 复制 上来 看看
// StudentManagerNewDlg.h : 头文件 // #pragma once #include "afxwin.h" #include "afxcmn.h" typedef struct tag_Student { CString m_Name; CString m_Gender; CString m_Class; CString m_Phone; CString m_IsLeader; }Student; // CStudentManagerNewDlg 对话框 class CStudentManagerNewDlg : public CDialogEx { // 构造 public: CStudentManagerNewDlg(CWnd* pParent = NULL); // 标准构造函数 // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_STUDENTMANAGERNEW_DIALOG }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 // 实现 protected: HICON m_hIcon; Student m_Student[500]; // 生成的消息映射函数 virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: CListBox m_ListBox; CString m_StudentName; CString m_StudentClass; CString m_StudentPhone; CButton m_IsLeader; CListCtrl m_StudentView; afx_msg void OnBnClickedOk(); afx_msg void OnLbnSelchangeStudentlist(); };
lx624909677 2016-02-23
  • 打赏
  • 举报
回复
引用 35 楼 qkq666 的回复:
[quote=引用 34 楼 lx624909677 的回复:] [quote=引用 32 楼 qkq666 的回复:] [quote=引用 31 楼 lx624909677 的回复:] 不要看那个红字,先编译下,看看编译能过不,那个错误的提示有时会有“延迟”
恩恩,是会有延迟的,之前的几个红字的再打开就通过了,但是m_stStudent这个过不去,编译的话失败。[/quote] 编译结果中,显示的这个错误具体是什么?[/quote] 未定义[/quote] 那就看下这个变量对应的类在哪儿,点击类名按F12看看,还有就是仔细检查类名
lx624909677 2016-02-23
  • 打赏
  • 举报
回复
引用 32 楼 qkq666 的回复:
[quote=引用 31 楼 lx624909677 的回复:] 不要看那个红字,先编译下,看看编译能过不,那个错误的提示有时会有“延迟”
恩恩,是会有延迟的,之前的几个红字的再打开就通过了,但是m_stStudent这个过不去,编译的话失败。[/quote] 编译结果中,显示的这个错误具体是什么?
schlafenhamster 2016-02-23
  • 打赏
  • 举报
回复
越说越 乱 把 StudentManagerDlg.h 复制 上来 看看
qkq666 2016-02-23
  • 打赏
  • 举报
回复
引用 31 楼 lx624909677 的回复:
不要看那个红字,先编译下,看看编译能过不,那个错误的提示有时会有“延迟”
恩恩,是会有延迟的,之前的几个红字的再打开就通过了,但是m_stStudent这个过不去,编译的话失败。
schlafenhamster 2016-02-23
  • 打赏
  • 举报
回复
那哪里来的 CStudentManagerNewDlg::OnBnClickedOK() ?? CStudentManagerDlg 还是 CStudentManagerNewDlg
qkq666 2016-02-23
  • 打赏
  • 举报
回复
引用 39 楼 schlafenhamster 的回复:
或者 把 Student m_Student[500]; 放 CStudentManagerNewDlg 中
是在StudentManagerDlg.h中// CStudentManagerNewDlg 对话框里? 试了试还是不行,整个无论出现在StudentManagerDlg.h哪部分都无法识别,解决方案中也没有 CStudentManagerNewDlg 文件啊
schlafenhamster 2016-02-23
  • 打赏
  • 举报
回复
即 不能在 StudentManagerNewDlg 中 用
schlafenhamster 2016-02-23
  • 打赏
  • 举报
回复
或者 把 Student m_Student[500]; 放 CStudentManagerNewDlg 中
schlafenhamster 2016-02-23
  • 打赏
  • 举报
回复
protected: HICON m_hIcon; Student m_Student[500]; 只能 在 本类(和派生类)中 使用,如果 别的 类 使用, 要 public 并通过 StudentManagerNewDlg 实例 调用
schlafenhamster 2016-02-22
  • 打赏
  • 举报
回复
"还是显示无法识别的标识" 把 typedef struct tag_Student 放 定义 Student m_Student[500]; 的文件里
HaoYuan 2016-02-22
  • 打赏
  • 举报
回复
原来还有人在学MFC啊
qkq666 2016-02-22
  • 打赏
  • 举报
回复
引用 24 楼 schlafenhamster 的回复:
typedef struct tag_Student ; 不要 嵌套到 类中, 直接 在 h 的 开头
Student m_stStudent[500];或者Student m_Student[500];还是显示无法识别的标识
schlafenhamster 2016-02-22
  • 打赏
  • 举报
回复
typedef struct tag_Student ; 不要 嵌套到 类中, 直接 在 h 的 开头
qkq666 2016-02-22
  • 打赏
  • 举报
回复
引用 22 楼 schlafenhamster 的回复:
放 StudentManagerDlg.h 里
protect:
Student m_Student[500];
schlafenhamster 2016-02-22
  • 打赏
  • 举报
回复
放 StudentManagerDlg.h 里 protect: Student m_Student[500];
加载更多回复(25)

16,472

社区成员

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

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

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