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]; ...
随机推荐
- const 还是 static readonly
到底是 const 还是 static readonly 真的一样? const 和 static readonly 常在程序中用来声明常量,调用方法也没有什么不同,他们真的一样吗?我们可以做个试 ...
- Cassandra
NoSQL之Cassandra 9月初听了一个讲座,演讲者是张月同学,他给我们分享了Cassandra nosql数据库,讲得很精彩,听完之后收益良多. Cassandra是一个noSQL数据库, ...
- struts2图片显示
struts2图片显示即是文件下载 一.配置struts.xml struts.xml中配置stream结果类型,并配置contentType.inputName.contentDisposition ...
- java的抽象类和抽象方法(注意查看如何调用抽象类中的非抽象方法)
抽象类就是不能使用new方法进行实例化的类,即没有具体实例对象的类.抽象类有点类似“模板”的作用,目的是根据其格式来创建和修改新的类.对象不能由抽象类直接创建,只可以通过抽象类派生出新的子类,再由其子 ...
- 编程实战——电影管理器之界面UI及动画切换
编程实战——电影管理器之界面UI及动画切换 在前文“编程实战——电影管理器之利用MediaInfo获取高清视频文件的相关信息”中提到电影管理器的目的是方便播放影片,在想看影片时不需要在茫茫的文件夹下找 ...
- OpenCV3.0.0+win10 64位+vs2015环境的下载,安装,配置
操作系统:WIN10 pro 64 软件版本:VS2015+OpenCV3.0.0 1. 下载安装 http://opencv.org/ https://www.visualstudio.com/ ...
- Web缓存解决方案
缓存是构建于HTTP统一接口之上的最有用功能之一.可以利用缓存减少终端用户感知到的延时,增加可靠性,减少带宽使用和成本,降低服务器负载.缓存无处不在,可以在服务器网络里,内容分发网络(Content ...
- 先对数组排序,在进行折半查找(C++)
第一步:输入15个整数 第二步:对这15个数进行排序 第三部:输入一个数,在后在排好序的数中进行折半查找,判断该数的位置 实现代码如下: 方法一: 选择排序法+循环折半查找法 #include< ...
- Wireshark抓包介绍和TCP三次握手分析
wireshark介绍 wireshark的官方下载网站: http://www.wireshark.org/ wireshark是非常流行的网络封包分析软件,功能十分强大.可以截取各种网络封包,显示 ...
- linux常见笔试题
一.填空题: 1. 在Linux系统中,以 文件 方式访问设备 . 2. Linux内核引导时,从文件 /etc/fstab 中读取要加载的文件系统. 3. Linux文件系统中每个文件用 i节点 来 ...