c - Linux 终端 - 错误 : label at end of compound statement

标签 c linux gcc terminal makefile

我通过 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

这里是函数'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
      }
    }

我该怎么办?

最佳答案

之所以遇到错误 label at end of compound statement 是因为 default case 不能为空,这意味着你必须提供一个 break ; 空语句。

已编辑:我找到了一些关于该主题的 Material ,我得到了:https://mail.gnome.org/archives/evolution-patches/2004-April/msg00235.html ,是编译器gcc3.4的问题,在default without statements报错,在gcc3.3上是warning,但是现在,我在gcc4.8.2上测试,都是对……

关于c - Linux 终端 - 错误 : label at end of compound statement,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22812610/

相关文章:

c - 如何将条件作为参数传递给 C 中的函数?

c - 有没有办法返回在 C 中导致 SIGSEGV 的地址?

linux - 如何在我的终端中默认更改目录? (命令行)

ruby - 在服务器上运行脚本的最佳方式(甚至是 cron)但很容易公开日志

c - 内存分配代码错误

c++ - gcc 找不到要链接的库

C 函数通过参数之一返回结构数据

c - 在 GNU C 内联汇编中编写 Linux int 80h 系统调用包装器

c - printf 没有打印出预期的结果,为什么?

c++ - 链接器错误;找不到结构中的静态变量