Visual C++ 程序设计(王明福、高教版)4.2章节___开发MyCalculator程序中的error C2065: 'UpdateDisplay' : undeclared identifier问题

来源:互联网 发布:淘宝浏览器手机版 编辑:程序博客网 时间:2024/05/16 09:54

a. MyCalculatorDlg.h中为函数Calculate(),UpdateDisplay()添加定义声明:

afx_msg void Calculate();

      afxmsg void UpdateDisplay(double lVal);

    添加成功如下:


//{{AFX_MSG(CMyCalculatorDlg)
 virtual BOOL OnInitDialog();
 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
 afx_msg void OnPaint();
 afx_msg HCURSOR OnQueryDragIcon();
 afx_msg void OnButton0();
 afx_msg void OnButton1();
 afx_msg void OnButton2();
 afx_msg void OnButton3();
 afx_msg void OnButton4();
 afx_msg void OnButton5();
 afx_msg void OnButton6();
 afx_msg void OnButton7();
 afx_msg void OnButton8();
 afx_msg void OnButton9();
 afx_msg void OnButtonAdd();
 afx_msg void OnButtonClear();
 afx_msg void OnButtonDiv();
 afx_msg void OnButtonEqual();
 afx_msg void OnButtonMinus();
 afx_msg void OnButtonMutiply();
 afx_msg void OnButtonReciprocal();
 afx_msg void OnButtonPoint();
 afx_msg void OnButtonSign();
 afx_msg void OnButtonSqrt();
 afx_msg void Calculate();
 afx_msg void UpdateDisplay(double lVal);
 //}}AFX_MSG



b. error C2065: 'fabs' : undeclared identifier

    error C2065: 'sqrt' : undeclared identifier

    在MyCalculator.cpp中添加头文件:

#include "math.h"

原创粉丝点击