error C2833 MFC添加任意自定义函数报错

发布于 2020-05-05  79 次阅读


问题描述:

c:program filesmicrosoft visual studiovc98includecrtdbg.h(536) : error C2833: ‘operator DEBUG_NEW’ is not a recognized operator or type

c:program filesmicrosoft visual studiovc98includecrtdbg.h(536) : error C2059: syntax error : ‘newline’

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(674) : error C2833: ‘operator DEBUG_NEW’ is not a recognized operator or type

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(674) : error C2059: syntax error : ‘newline’

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(674) : error C2238: unexpected token(s) preceding ‘;’

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(675) : error C2833: ‘operator DEBUG_NEW’ is not a recognized operator or type

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(675) : error C2059: syntax error : ‘newline’

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(675) : error C2238: unexpected token(s) preceding ‘;’

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(683) : error C2833: ‘operator DEBUG_NEW’ is not a recognized operator or type

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(683) : error C2059: syntax error : ‘newline’

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(683) : error C2238: unexpected token(s) preceding ‘;’

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(1631) : error C2833: ‘operator DEBUG_NEW’ is not a recognized operator or type

c:program filesmicrosoft visual studiovc98mfcincludeafx.h(1631) : error C2059: syntax error : ‘newline’

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(122) : error C2059: syntax error : ‘string’

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(123) : error C2091: function returns function

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(123) : error C2802: static member ‘operator new’ has no formal parameters

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(123) : error C2333: ‘new’ : error in function declaration; skipping function body

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(131) : error C2059: syntax error : ‘string’

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(131) : error C2091: function returns function

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(131) : error C2802: static member ‘operator new’ has no formal parameters

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(135) : error C2059: syntax error : ‘string’

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(135) : error C2091: function returns function

c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(135) : error C2556: ‘void *(__cdecl *__stdcall CNoTrackObject::operator new(void))(unsigned int,const char *,int)’ : overloaded function differs only by return type from ‘void *(__c

decl *__stdcall CNoTrackObject::operator new(void))(unsigned int)’

       c:program filesmicrosoft visual studiovc98mfcincludeafxtls_.h(131) : see declaration of ‘new’

执行 cl.exe 时出错.


解决方法:

把Debug目录下的 .pch文件删除


一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。