我的错误如下:
Skipping... (no relevant changes detected)
MainFrm.cpp
Linking...
messageView.obj : error LNK2001: unresolved external symbol "protected: void __thiscall CMessageView::OnMyMessage(unsigned int,long)" (?OnMyMessage@CMessageView@@IAEXIJ@Z)
Debug/message.exe : fatal error LNK1120: 1 unresolved externals
下面是我改动的代码注意我添加了这样一个函数 void OnMyMessage(WPARAM wParam,LPARAM lParam);
class CMainFrame : public CFrameWnd
{
.....//省掉部分代码
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CMainFrame();
void OnMyMessage(WPARAM wParam,LPARAM lParam);
......
}
在另外一个文件里,我对这个函数进行定义,注意我包含了头文件#include "MainFrm.h "
void CMainFrame::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
}为的是实现自定义消息映射
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)可以报错了55555555
Skipping... (no relevant changes detected)
MainFrm.cpp
Linking...
messageView.obj : error LNK2001: unresolved external symbol "protected: void __thiscall CMessageView::OnMyMessage(unsigned int,long)" (?OnMyMessage@CMessageView@@IAEXIJ@Z)
Debug/message.exe : fatal error LNK1120: 1 unresolved externals
下面是我改动的代码注意我添加了这样一个函数 void OnMyMessage(WPARAM wParam,LPARAM lParam);
class CMainFrame : public CFrameWnd
{
.....//省掉部分代码
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CMainFrame();
void OnMyMessage(WPARAM wParam,LPARAM lParam);
......
}
在另外一个文件里,我对这个函数进行定义,注意我包含了头文件#include "MainFrm.h "
void CMainFrame::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
}为的是实现自定义消息映射
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)可以报错了55555555
解决方案 »
- 1bit转化为32bitbmp 遇到问题
- 请问将单选框设置为灰色(不可选)的函数是哪个?
- 使用InterlockedIncrement时,必须全部都用InterlockedIncrement 吗
- 请问WM_MOUSEMOVE消息的lParam参数所指的坐标位置是鼠标移动中的所有位置,还是鼠标移动的起点,还是终点?
- 大家快给看看,憋死了都,res\wenjianming.rc2 for dependencies.
- 轻松一下 本周最新的音乐分享!
- 程序员的迷茫:35/40岁后做什么?散分
- 请教把鼠标控制在一个区域中的方法
- 调用存储过程,CString 怎么传?
- 如何用vc对已打开的excel进行写入
- MFC 中如何显示曲线
- "internet exploer遇到问题需要关闭..."原因分析
改成
LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam)
错误提示说CMessageView::OnMyMessage(unsigned int,long)未定义
就是说系统没找到CMessageView类里的OnMyMessage函数,而你的函数却是定义在了CMainFrame 里,当然找不到了你的ON_MESSAGE映射是不是放在了CMessageView里了?要么把ON_MESSAGE映射放在CMainFrame 里,要么把函数声明和定义放到CMessageView里
还是CMainFrame类
{
.....//省掉部分代码
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CMainFrame();
afx_msg LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam); //修改......
}
在另外一个文件里,我对这个函数进行定义,注意我包含了头文件#include "MainFrm.h "
LRESULT CMainFrame::OnMyMessage(WPARAM wParam,LPARAM lParam) //修改{
}为的是实现自定义消息映射
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)
afx_msg void OnMyMessage(WPARAM wParam,LPARAM lParam);
Messages是我的工程名字 .....