刚开始学习VC++,对它的东西都不懂,其中最使用DECLARE_EVENTSINK_MAP时出现了一个错误,
Linking...
LegendWin.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_EVENTSINKMAP const * __thiscall CLegendWin::GetEventSinkMap(void)const " (?GetEventSinkMap@CLegendWin@@MBEPBUAFX_EVENTSINKMAP@@XZ)
Debug/MySuperMap.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
MySuperMap.exe - 2 error(s)
0 warning(s)
因为有 写了代码就编译验证其有没有错误的习惯,所以我在.h文件中申明了DECLARE_EVENTSINK_MAP()以后就编译,却出现错误。
原来是必须在.cpp中写出相应的代码段:
BEGIN_EVENTSINK_MAP(....,....)
相应代码.....
END_EVENTSINK_MAP()
网上搜了好久才找到解决方法的,郁闷。