用vc++编计算器程序时在定义一个CEdit类的子类MyEdit的成员变量m_DspEdit时有了下面的警告,
please ensure that "My calculator Dlg.h"contains the necessary #include directive(s) for using your CMyEdit(form
file"MyEdit.h")
以上是警告,编译完有好多下面的错误(各位高手帮帮忙吧,谢谢了)
:\documents and settings\owner\桌面\计算器\mycalculator\mycalculatordlg.h(25) : error C2146: syntax error : missing ';' before identifier 'm_DspEdit'
c:\documents and settings\owner\桌面\计算器\mycalculator\mycalculatordlg.h(25) : error C2501: 'CMyEdit' : missing storage-class or type specifiers
c:\documents and settings\owner\桌面\计算器\mycalculator\mycalculatordlg.h(25) : error C2501: 'm_DspEdit' : missing storage-class or type specifiers
C:\Documents and Settings\Owner\桌面\计算器\MyCalculator\MyCalculatorDlg.cpp(75) : error C2065: 'm_DspEdit' : undeclared identifier
C:\Documents and Settings\Owner\桌面\计算器\MyCalculator\MyCalculatorDlg.cpp(237) : error C2228: left of '.OnDisPlay' must have class/struct/union type
C:\Documents and Settings\Owner\桌面\计算器\MyCalculator\MyCalculatorDlg.cpp(263) : error C2228: left of '.OnDisPlay' must have class/struct/union type
C:\Documents and Settings\Owner\桌面\计算器\MyCalculator\MyCalculatorDlg.cpp(328) : error C2228: left of '.OnDisPlay' must have class/struct/union type
C:\Documents and Settings\Owner\桌面\计算器\MyCalculator\MyCalculatorDlg.cpp(330) : error C2228: left of '.OnDisPlay' must have class/struct/union type
C:\Documents and Settings\Owner\桌面\计算器\MyCalculator\MyCalculatorDlg.cpp(344) : error C2228: left of '.OnDisPlay' must have class/struct/union type
C:\Documents and Settings\Owner\桌面\计算器\MyCalculator\MyCalculatorDlg.cpp(346) : error C2228: left of '.OnDisPlay' must have class/struct/union type
追问:加上之后出了下面问题
c:\documents and settings\owner\桌面\计算器\mycalculator\mycalculatordlg.h(6) : error C2018: unknown character '0xa1'
\mycalculator\mycalculatordlg.h(6) : error C2018: unknown character '0xa1'
mycalculator\mycalculatordlg.h(6) : fatal error C1083: Cannot open include file: 'CMyEdit.h': No such file or directory
MyCalculatorDlg.cpp
\没有把,因为我是看着书按书上步骤做的,书上说用ClassWizard建个新类CMyEdit 基于(Baseclass)CEdit.然后增加成员变量m_DspEdit,完成了点确定时就出了上面的警告,编译完成出了好多错误,是不是没加什么头文件啊?
答案:在你的mycalculatorDlg.h
里加上#include "MyEdit.h""
其他:成员变量类型定义错误了吧,看看自己写错了没 编辑框拥有一个标识,比如叫IDC_XXX_XXX,设置CEdit型变量,比如m_edit,是VC6.0为例,查看— 删掉加的类试试,看是代码问题,还是VC问题
上一个:看这个VC ++ 2010 程序怎么不能编译啊,
下一个:关于java