error: jump to label ‘XXXX’ [-fpermissive](转)
作者:互联网
http://www.cnblogs.com/foohack/p/4090124.html
下面的类似的源码在MSVC上能正确编译通过。但是gcc/g++上就会错:
1. if(expr)
2. goto error;
3. size_t var = 0;
4.error:
5 error_handle();
4:1: error: jump to label ‘error’ [-fpermissive]
2:35: error: from here [-fpermissive]
3:9: error: crosses initialization of ‘size_t var’
解决以上问题就是要么所有变量初始化都放在函数开头,要么所有变量就不让它初始化,写成这样:
size_t var;
var = 0;
这样错误就解决了。
reference:
http://tieba.baidu.com/p/3319980115?pid=58076852390&cid=#58076852390
标签:fpermissive,http,label,jump,error,var,size 来源: https://www.cnblogs.com/xihong2014/p/16325908.html