今天做一个小程序,我本想在自定义的工具栏上加入自定义消息映射(没有在菜单上设计同样的消息。
主要代码如下:
申明:
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 个警告
主要代码如下:
申明:
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 个警告
解决方案 »
- 菜单栏文本修改
- 有的可执行文件在运行的时候可以改名时为什么?,请老师解答!
- VC 连接 SQL SERVER/oracle等数据库时采用哪种方式效率要高?
- 请教一个和在openGL中一个与main函数有关的问题
- [求助]我的 Intel C++ 9 编译器在 VC6 里怎么老出错?
- 怎样启动远程计算机上的程序,有什么办法.
- 编写Dll时C文件与C++文件有什么不同?
- 这是怎么回事?奇怪?望指教?
- 我想让一个单文档窗口一启动就隐藏,为什么总是要闪一下才隐藏呢?谢谢!
- 想搞一个网上传真服务网络,谁有意加盟?
- GetCursorPos得到的位置是相对于屏幕还是程序当前窗口?
- 求助在LINUX下的程序运行的命令问题
如下:
我以前写的是:
void OnRect()
{ //option=1;
}
void OnRound()
{ //option=2;
}
void OnLine()
{//option=3;
}
//现在:
void CMainFrame::OnRect()
{
//option=1;}
void CMainFrame::OnRound()
{
//option=2;
}
void CMainFrame::OnLine()
{
//option=3;
}多谢仁兄!