error: a label can only be part of a statement and a declaration is not a statement
GCC:
error: a label can only be part of a statement and a declaration is not a statement
switch(a){ swtch(a){
case 1: case 1:
.................... {
.................... ...............
.................... ...............
break; ................
case 2: }
break; break;
} case 2:
break;
}
Error OK
case1:
//此块代码不能再声明变量,如果你声明变量就会报错,除非用括号括起来,这是编译器的问题,也可以说是C语言的规定。写代码的时候注意就成了。就像C语言再声明的时候不能赋值一样,记住就好了。
break;
希望对你有所帮助。
error: a label can only be part of a statement and a declaration is not a statement的更多相关文章
- c 编译异常 switch 之a label can only be part of a statement and a declaration is not a statement
client.c:996: error: a label can only be part of a statement and a declaration is not a statement sw ...
- ERROR 1666 (HY000): Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT.
centos7.5 binlog恢复数据失败 问题: mysql> \. /tmp/inc.sql ERROR 1050 (42S01): Table 'new_1' already exist ...
- a label can only be part of statement and a declaratioin is not a statement
参考资料: https://stackoverflow.com/questions/18496282/why-do-i-get-a-label-can-only-be-part-of-a-statem ...
- Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in
学习php的命名空间,直接把手册的代码粘贴过来,却报错了:Fatal error: Namespace declaration statement has to be the very first s ...
- mysqldump 使用--tab=path参数时提示mysqldump: Got error: 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement when executing 'SELECT INTO OUTFILE'
报错: [root@zedu test]# mysqldump -h127.0.0.1 -uroot -p --single-transaction --add-drop-database --tab ...
- [ThinkPHP]报错:Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in E:\wamp\www\jdlh\application\index\controller\Index.php on line
错误提示说命名空间声明语句必须是第一句,可我看就是第一句没毛病呀,这是为啥呢,后面发现<?php 前面有个空格,删掉就正常了 去掉空格之后页面能正常显示
- switch的case中不能做定义
switch的case中不能做定义 只能给语句 error: a label can only be part of a statement and a declaration is not a st ...
- 关于gcc的一点小人性化提示
现在对于大多数平台的C编译器来说都会有很多种选择,而gcc和clang无疑是2个非常优秀的C编译器.当然他们也不只是C编译器.我最近用clang的比较多,原因有很多.不过一些小的细节很让我喜欢,比如O ...
- 在switch中的case语句中声明变量编译出错的解决方案
在switch中的case语句中声明变量编译的问题 先来看段代码,别管什么意思: : , j = ; ; i < ; i++) recive_phone[i] = msgbuf.text[i]; ...
随机推荐
- iOS基础 - 多媒体
一.播放视频 iOS提供了叫做MPMoviePlayerController.MPMoviePlayerViewController的两个类,可以用来轻松播放视频 YouTobe就是用MPMovieP ...
- iOS基础 - 完善键盘处理
1.完善键盘处理 步骤一:创建一个数组,里面装着所有的文本框. 步骤二:监听所有文本框的开始编辑,设置所有文本框的代理为控制器 1.设置生日和城市不允许键盘输入 2.当开始编辑的时候调用,用一个成员属 ...
- DesignMode的状态处理
自定义控件开发的调试及DesignMode的状态处理 在开发Winform程序的时候,我们往往需要根据需要做一些自定义的控件模块,这样可以给系统模块重复利用,或者实现更好的效果等功能.但在使用的时候, ...
- IIS 7.5配置PHP站点
准备工作 首先下载并解压PHP程序文件,比如解压到C:/PHP/,不需要安装.IIS安装略. 第一步:添加ISAPI筛选器和CGI功能 控制面板—>程序和功能—>打开或关闭Windows功 ...
- Eclipse添加Web和java EE插件
1.在Eclipse中菜单help选项中选择install new software选项 2.在work with 栏中输入 Juno - http://download.eclipse.org/re ...
- MVC 静态化的ActionFilter
在MVC中,需要对某些页面进行静态化,用ActionFilter来做静态化,把页面存到缓存中.如下代码所示,其中Result.RenderString是扩展方法,第一次缓存的时候,Action代码会运 ...
- linux下使用kpartx挂载虚拟文件系统
在linux中,如果映像文件(.img)含有分区表的话,那么用losetup这个程序来加载文件系统就有点力不从心了.因为losetup只能加载无分区的文件系统映像文件.不过有一个好东西配合losetu ...
- Define Constraints That Are Minimal and Sufficient 设定不多不少的约束
Define Constraints That Are Minimal and Sufficient 设定不多不少的约束 今天第二章第二节. 主管不在,然后暂时没什么任务,把第二节看了,然后整理一 ...
- .net SoapHeader验证
.net SoapHeader验证 在工作中经常用到webservice,在.net 开发中经常用到webservice,在java开发经常用到cxf. 今天闲置没事就介绍下 .net webserv ...
- EM算法详解
EM算法详解 1 极大似然估计 假设有如图1的X所示的抽取的n个学生某门课程的成绩,又知学生的成绩符合高斯分布f(x|μ,σ2),求学生的成绩最符合哪种高斯分布,即μ和σ2最优值是什么? 图1 学生成 ...