C++编译报错:error: jump to label ‘xxx‘ [-fpermissive](不能在goto后目标前定义变量)

Posted Dontla

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++编译报错:error: jump to label ‘xxx‘ [-fpermissive](不能在goto后目标前定义变量)相关的知识,希望对你有一定的参考价值。

同样的代码,用c编译器时不会报错,转换成c++编译就报错了

原因是在goto语句,与goto目标点之间,不能定义新的变量,如果要定义,就在goto语句前定义好,,也不知道为什么c++编译器要这么规定,,,

全给搞到goto前面去先声明一下:

参考文章 :error: jump to label [-fpermissive]

以上是关于C++编译报错:error: jump to label ‘xxx‘ [-fpermissive](不能在goto后目标前定义变量)的主要内容,如果未能解决你的问题,请参考以下文章

c/c++编译错误收集error: jump to case label

C/C++编译错误收集error: jump to label ‘XXXX’ [-fpermissive]

error: jump to case label

c/c++编译错误收集error: jump to case label [-fpermissive] crosses initialization of ‘xxx‘

ndk-build 编译报错 fatal error: error writing to -: Invalid argument } ^

C++ 编译运行报错 error: stray ‘200’ in program 解决方案