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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. [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 前面有个空格,删掉就正常了 去掉空格之后页面能正常显示

  7. switch的case中不能做定义

    switch的case中不能做定义 只能给语句 error: a label can only be part of a statement and a declaration is not a st ...

  8. 关于gcc的一点小人性化提示

    现在对于大多数平台的C编译器来说都会有很多种选择,而gcc和clang无疑是2个非常优秀的C编译器.当然他们也不只是C编译器.我最近用clang的比较多,原因有很多.不过一些小的细节很让我喜欢,比如O ...

  9. 在switch中的case语句中声明变量编译出错的解决方案

    在switch中的case语句中声明变量编译的问题 先来看段代码,别管什么意思: : , j = ; ; i < ; i++) recive_phone[i] = msgbuf.text[i]; ...

随机推荐

  1. 长乐集训2012.7.11 happy(指针技巧的运用)

    题1  Noip的快乐 (happy.pas/c/cpp) [问题描述] 终于到了一年一度的Noip比赛了,多么令人期待和兴奋的一天!其实,人们最高兴的还不是遇见老朋友,而是结交新朋友.可是结交新的朋 ...

  2. Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY'

    The error that occurs is:Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /w ...

  3. [RM 状态机详解1] RMApp状态机详解

    概述 Apache Hadoop 2.0在Hadoop 1.0基础上做了许多的重构工作,代码上的重构最大的变化在于引入状态机处理各个角色的状态与变迁,使用状态机是得代码结构更加清晰,方便异步处理各种操 ...

  4. windows phone 8环境搭建

    windows phone 8 开发系列(一)环境搭建   一:前奏说明 本人一名普通的neter,对新玩意有点小兴趣,之前wp7出来的时候,折腾学习过点wp7开发,后来也没怎么用到(主要对微软抛弃w ...

  5. 由浅入深shell脚本训练

    由浅入深shell脚本训练 最近一直在学习Shell,以前一直觉得Shell语法很难,不好学,现在总算有一些收获了.其实Shell脚本就是一堆linux命令的集合,把脚本里每一步的命令搞懂是什么意思, ...

  6. 2013年全球IT公司市值排行榜

    开源的应用快速开发平台 排名 公司 市值 国家 荣誉 1 苹果 5006.1 美国 全球市值最大的公司 2 谷歌 2324.4 美国 全球最伟大的互联网公司 3 三星 2290.7 韩国 全球最大的智 ...

  7. Spring的Service层与Dao层解析

    本文转载于网络,觉得写得很透彻. dao完成连接数据库修改删除添加等的实现细节,例如sql语句是怎么写的,怎么把对象放入数据库的.service层是面向功能的,一个个功能模块比如说银行登记并完成一次存 ...

  8. C# 编写简易 ASP.NET Web 服务器

    C# 编写简易 ASP.NET Web 服务器 你是否有过这样的需求——想运行 ASP.NET 程序,又不想安装 IIS 或者 Visual Studio?我想如果你经常编写 ASP.NET 程序的话 ...

  9. TOGAF架构开发方法(ADM)之迁移规划阶段

    TOGAF架构开发方法(ADM)之迁移规划阶段 1.8 迁移规划(Migration Planning) 企业架构开发方法各阶段——迁移规划 1.8.1 目标 本阶段的目标是: 确保实施和迁移规划与企 ...

  10. [置顶] iOS学习笔记47——图片异步加载之EGOImageLoading

    上次在<iOS学习笔记46——图片异步加载之SDWebImage>中介绍过一个开源的图片异步加载库,今天来介绍另外一个功能类似的EGOImageLoading,看名字知道,之前的一篇学习笔 ...