MFC——error LNK2005: "protected: static struct AFX_MSGMAP
来源:互联网 发布:布鲁斯威利斯 知乎 编辑:程序博客网 时间:2024/06/07 05:49
好久没弄VC程序了,今天弄了下,还会用公司给的窗口重绘作为基类来实现,竟然报了这个错误。
找了一下是这里:
有个窗口重绘类是基类:
class CBaseDlg : public CDialog
新建一个对话框类
class CTestDlg: public CBaseDlg
在消息映射的地方:
BEGIN_MESSAGE_MAP(CBaseDlg , CDialog)
//{{AFX_MSG_MAP(CTestDlgDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
报错的就是红色标记的,因为在基类有:
BEGIN_MESSAGE_MAP(CSkinDlg, CDialog)
ON_WM_SIZE()
ON_WM_PAINT()
END_MESSAGE_MAP()
所以重复定义了,应该是:
BEGIN_MESSAGE_MAP(CTestDlg,CBaseDlg )
这是个小问题,不过出错了,不容易找,最主要的是要弄清楚原理前面是派生类,后面是基类。
转载请注明原创链接:http://blog.csdn.net/wujunokay/article/details/12454469
- MFC——error LNK2005: "protected: static struct AFX_MSGMAP
- error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP ......
- unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall
- vc6.0 /mfc中的错误:see declaration of 'AFX_MSGMAP 、GetMessageMap 、syntax error : missing '; ' before '* '
- error lnk2005
- error LNK2005
- error LNK2005:
- error LNK2005
- error LNK2005
- error LNK2005
- ERROR LNK2005
- error LNK2005:
- error LNK2005
- error LNK2005:
- error LNK2005
- error LNK2005
- error LNK2005
- error LNK2005
- POJ-3415-Common Substrings
- 解决Android屏幕横竖屏设置
- SQL Server 2008 常见异常收集(持续更新)
- auto_ptr解析
- 开始吧,少年,现在也一点也晚
- MFC——error LNK2005: "protected: static struct AFX_MSGMAP
- CBIR--Survey.C/GPU优化.Sys搭建
- libvirt虚拟机配置文件的 配置参数
- shared_ptr解析
- 你真的理解Java的this和super吗?
- 忠实的朋友
- Flex组件出错(一)
- 问题解决:Ubuntu 12.04 Gedit 中文乱码问题
- 对算法导论中用循环不变式证明算法正确性的理解