C++编译器错误 C2362

C++ Compiler Error C2362

本文关键字:C2362 错误 编译器 C++      更新时间:2023-10-16

代码是这样的

{
   int a;
     if( a == 0 )
     {
          std::string  str("some");
          goto CLEANUP;
     }

return;
CLEANUP: 
     printf("CLEANUP");

}

这给了我错误编译器错误 C2362"标识符"的初始化被"转到标签"跳过

我移动了std::string str("some");int a之后;它仍然给了我同样的错误

是你的:

goto CLEANUP:

应该是:

goto CLEANUP;

(分号不是冒号)

编译器

错误 C2362

http://msdn.microsoft.com/en-us/library/s6s80d9f%28v=vs.80%29.aspx

 if( a == 0 )
     {
          std::string  str("some");
          goto CLEANUP:
     }

应该是

goto CLEANUP;
goto CLEANUP:

应该是,

goto CLEANUP;

[另外,请确保您的代码编译为printf最后不正确]