error C2059: syntax error : ‘catch’ 或者 error C2059: 语法错误 : “catch”

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


问题描述:

C:Program FilesMicrosoft Visual Studio 10.0VCatlmfcincludeatlcomcli.h(1101): error C2059: syntax error : ‘catch’

1>C:Program FilesMicrosoft Visual Studio 10.0VCatlmfcincludeatlcomcli.h(1101): error C2143: syntax error : missing ‘;’ before ‘{‘

或者

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(954) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(954) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(970) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(970) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(995) : error C2712: 无法在要求对象展开的函数中使用 __try

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(1008) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(1008) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(1024) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(1024) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(1190) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludeatlcomcli.h(1190) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(107) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(107) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(113) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(113) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(423) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(423) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(587) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(587) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(901) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(901) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(971) : error C2059: 语法错误 : “catch”

1>C:Program FilesMicrosoft Visual Studio 9.0VCatlmfcincludestatreg.h(971) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)


解决方法:

方法(一)

项目属性 | 配置属性 | C/C++ | 预处理器 | 预处理器定义(properties->Configuration Properties->C/C++->PreProcessor->Preprocessor Definitions),看是否在里面定义了try=_try,有的话把这个删除试试

方法(二)

项目属性 | 配置属性 | C/C++ | 预处理器 | 预处理器定义(properties->Configuration Properties->C/C++->PreProcessor->Preprocessor Definitions),然后在右边 加入 _CPPUNWIND


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