这个C编译器错误是什么意思?

时间:2013-03-14 03:36:07

标签: c function compiler-construction

每次编译程序时都会出现此错误:

 ch.c: In function 'my_ch':
 ch.c:8:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{'
     token
 ch.c:20:1: error: expected '{' at end of input

但我认为我的格式正确:

void my_ch ()
{
    /*some initialization stuff here*/

    while ( /*conditions here*/ ) {
        /*insert some code here*/
    }

return;
}

我的第8行是void my_ch ()之后的行,第20行是return;之后的行。有没有人知道为什么错误会一直出现?非常感谢

修改

//ch
#include <stdio.h>
#include "ch.h"
#define BUFLEN 2500
#define MAC 3000
<space>

第七行是void my_ch()

2 个答案:

答案 0 :(得分:1)

ch.h可能有一个没有';'的结构声明在结束'}'之后。

答案 1 :(得分:1)

ch.h中有些东西未完成。也许类似于函数原型,最后会丢失分号。什么是ch.h?

相关问题