【问题标题】:Linux terminal - error: label at end of compound statementLinux终端 - 错误:复合语句末尾的标签
【发布时间】:2014-05-13 19:18:39
【问题描述】:

我通过 VMware Player 使用 x64 Ubuntu Linux 作为虚拟机。作为我项目的一部分,我需要安装一些库(fec-3.0.1)。我是 Linux 新手,不擅长编码。

这是我配置成功后在终端遇到的错误:

    farhat@ubuntu:~/project/fatcaps_v0.5/fec-3.0.1$ make
    gcc -g -O2 -I. -Wall    -c -o dotprod.o dotprod.c
    dotprod.c: In function ‘freedp’:
    dotprod.c:56:3: error: label at end of compound statement
       default:
       ^
    make: *** [dotprod.o] Error 1

这里是function 'freedp'内容(起始行是55):

    /* Free a dot product descriptor created earlier */
    void freedp(void *p){
      switch(Cpu_mode){
      case PORT:
      default:
    #ifdef __i386__
      case MMX:
      case SSE:
        return freedp_mmx(p);
      case SSE2:
        return freedp_sse2(p);
    #endif
    #ifdef __VEC__
      case ALTIVEC:
        return freedp_av(p);
    #endif
      }
    }

我该怎么办?

【问题讨论】:

    标签: c linux gcc terminal makefile


    【解决方案1】:

    你遇到错误label at end of compound statement的原因是default case不能为空,也就是说你必须提供break或者;空语句。

    已编辑:我找到了一些关于该主题的材料,我得到了:https://mail.gnome.org/archives/evolution-patches/2004-April/msg00235.html,这是编译器 gcc3.4 的问题,它在default 上报告错误而没有声明,在gcc3.3上是警告,但现在,我在gcc4.8.2上测试,没问题....

    【讨论】:

      猜你喜欢
      • 2022-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-16
      相关资源
      最近更新 更多