严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2001 无法解析的外部符号 "public: void __thiscall Dialog_Home::OnBnClickedButton5(void)" (?OnBnClickedButton5@Dialog_Home@@QAEXXZ) SeriPortSend D:\我的文档\Desktop\南方电子面谈\区域γ探头示列代码 -goodone-190101\SeriPortSend\Dialog_Home.obj 1
当编译报这个错误是:出现了野指针的情况。
因为这个按钮:OnBnClickedButton5(void),双击生成了代码,然后有改了这个按钮的ID,然后双击按钮,有生成了代码。
然后注释了这行代码,
就会报错。
解决方法:
cpp的map位置也要注释掉。
BEGIN_MESSAGE_MAP(Dialog_Home, CDialogEx) ON_BN_CLICKED(IDC_BUTTON2, &Dialog_Home::OnBnClickedButton2) ON_BN_CLICKED(IDC_BUTTON_Cleaning, &Dialog_Home::OnBnClickedButtonCleaning) //ON_BN_CLICKED(IDC_BUTTON5, &Dialog_Home::OnBnClickedButton5) ON_BN_CLICKED(IDC_BUTTON_DataView, &Dialog_Home::OnBnClickedButtonDataview) END_MESSAGE_MAP()
头文件也有注释掉。
public: afx_msg void OnBnClickedButton2(); afx_msg void OnBnClickedButtonCleaning(); BOOL OnInitDialog(); // afx_msg void OnBnClickedButton5(); afx_msg void OnBnClickedButtonDataview(); };