首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

error C2143: syntax error : missing ';' before 'catch'解决方法

2012-08-31 
error C2143: syntax error : missing before catchcharPath1_Parameter(){charpath1return pat

error C2143: syntax error : missing ';' before 'catch'
 
  char Path1_Parameter()  
  {
char path='1';
return path;
  }


  char Catch_Parameter1()
  {
char catch='1'; //显示这句出错
return catch;
  }

  //这句有4个错误
  error C2059: syntax error : '='
  error C2309: catch handler expected a parenthesized exception declaration
  error C2319: 'catch' must be followed by a compound statement. Missing '{'

  奇怪的是:char Path1_Parameter()这个函数并没有报错。
  我用的编译器是VC6.0
  遇到过类似错误的,给点意见吧,谢谢


[解决办法]
try{} catch(…){}
是C++用来捕获异常的,不要用系统的关键字try cathc等命名变量
改为其他的字符

热点排行