今天做一个小程序,我本想在自定义的工具栏上加入自定义消息映射(没有在菜单上设计同样的消息。
主要代码如下:
申明:
afx_msg void OnRect();
afx_msg void OnRound();
afx_msg void OnLine();
消息映射:IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
ON_COMMAND(ID_RECT,OnRect)
ON_COMMAND(ID_ROUND,OnRound)
ON_COMMAND(ID_LINE,OnLine)
END_MESSAGE_MAP()//MainFrm.cpp
void OnRect()
{ //option=1;
}
void OnRound()
{ //option=2;
}
void OnLine()
{//option=3;
}
但最后总有错误啊,请高手指教!谢谢!
错误是:
正在链接...
MainFrm.obj : error LNK2001: 无法解析的外部符号 "protected: void __thiscall CMainFrame::OnLine(void)" (?OnLine@CMainFrame@@IAEXXZ)
MainFrm.obj : error LNK2001: 无法解析的外部符号 "protected: void __thiscall CMainFrame::OnRound(void)" (?OnRound@CMainFrame@@IAEXXZ)
MainFrm.obj : error LNK2001: 无法解析的外部符号 "protected: void __thiscall CMainFrame::OnRect(void)" (?OnRect@CMainFrame@@IAEXXZ)
D:\Projects\Draw1.0\Debug\Draw1.0.exe : fatal error LNK1120: 3 个无法解析的外部命令
生成日志保存在“file://d:\Projects\Draw1.0\Draw1.0\Debug\BuildLog.htm”
Draw1.0 - 4 个错误,0 个警告