高手请进!MFC中的静态成员变量,静态成员函数问题!!!!
我在CMainFrame里定义了一个static int theVal;
定义了一个static int getVal(){return theVal;}
然后在CMyView下定义一个菜单命令,OnDisVal(){int m=CMainFrame::getVal();
CString str;str.Format("the value is :%d !",m);
MessageBox(str);
}
编译后系统提示:MainFrm.obj : error LNK2001: unresolved external symbol "public: static int CMainFrame::theVal" (?theVal@CMainFrame@@2HA)
Debug/testStatic2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
我不懂为什么???
请高手们不吝赐教!