读书人

MFC是不是很容易自动冒出异常来

发布时间: 2012-08-08 14:32:45 作者: rapoo

MFC是不是很容易自动冒出错误来?

C/C++ code
warning C4273: 'protected: static struct AFX_MSGMAP const CWinApp::messageMap' : inconsistent dll linkage.  dllexport assumed.D:\VC98\MFC\SRC\APPCORE.CPP(36) : error C2491: 'CWinApp::messageMap' : definition of dllimport static data member not allowedD:\VC98\MFC\SRC\APPCORE.CPP(66) : error C2065: 'AfxDeleteObject' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(156) : error C2514: 'CRecentFileList' : class has no constructors        d:\vc98\mfc\include\afxwin.h(3930) : see declaration of 'CRecentFileList'D:\VC98\MFC\SRC\APPCORE.CPP(157) : error C2027: use of undefined type 'CRecentFileList'        d:\vc98\mfc\include\afxwin.h(3930) : see declaration of 'CRecentFileList'D:\VC98\MFC\SRC\APPCORE.CPP(157) : error C2227: left of '->ReadList' must point to class/struct/unionD:\VC98\MFC\SRC\APPCORE.CPP(199) : error C2065: 'USES_CONVERSION' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(200) : error C2065: 'T2CA' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(298) : warning C4150: deletion of pointer to incomplete type 'CRecentFileList'; no destructor called        d:\vc98\mfc\include\afxwin.h(3930) : see declaration of 'CRecentFileList'D:\VC98\MFC\SRC\APPCORE.CPP(317) : error C2065: 'AfxGlobalFree' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(355) : error C2027: use of undefined type 'CRecentFileList'        d:\vc98\mfc\include\afxwin.h(3930) : see declaration of 'CRecentFileList'D:\VC98\MFC\SRC\APPCORE.CPP(355) : error C2227: left of '->WriteList' must point to class/struct/unionD:\VC98\MFC\SRC\APPCORE.CPP(430) : error C2065: 'WM_KICKIDLE' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(511) : error C2065: 'OpenPrinter' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(519) : error C2065: 'DocumentProperties' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(532) : error C2065: 'ClosePrinter' : undeclared identifierD:\VC98\MFC\SRC\APPCORE.CPP(574) : error C2027: use of undefined type 'CRecentFileList'        d:\vc98\mfc\include\afxwin.h(3930) : see declaration of 'CRecentFileList'D:\VC98\MFC\SRC\APPCORE.CPP(574) : error C2227: left of '->GetSize' must point to class/struct/unionD:\VC98\MFC\SRC\APPCORE.CPP(577) : error C2676: binary '[' : 'class CRecentFileList' does not define this operator or a conversion to a type acceptable to the predefined operatorD:\VC98\MFC\SRC\APPCORE.CPP(577) : error C2228: left of '.GetLength' must have class/struct/union typeD:\VC98\MFC\SRC\APPCORE.CPP(578) : error C2676: binary '[' : 'class CRecentFileList' does not define this operator or a conversion to a type acceptable to the predefined operatorD:\VC98\MFC\SRC\APPCORE.CPP(606) : warning C4273: 'public: static struct CRuntimeClass const CWinApp::classCWinApp' : inconsistent dll linkage.  dllexport assumed.D:\VC98\MFC\SRC\APPCORE.CPP(606) : error C2491: 'CWinApp::classCWinApp' : definition of dllimport static data member not allowedD:\VC98\MFC\SRC\APPCORE.CPP(609) : warning C4073: initializers put in library initialization areaMainFrm.cpp

开始还好好的没错误,程序可以运行。过一会再运行,怎么自动冒出这么多错误呀?

[解决办法]
你自己粗心罢了,而且正确的做法是写一点编译一次,这样错误也好改
[解决办法]
有时候需要重建所有。

偶遇到类似问题都是用
“每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。”
的方法解决的。

读书人网 >C++

热点推荐