Search code examples
cfunction

What does this C compiler error mean?


This error keeps on showing up everytime I compile my program:

 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

But I think I got my format right:

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

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

return;
}

My 8th line is the one after the void my_ch () and the 20th is the one after return;. Does anyone have a clue why the error keeps on showing up? Thanks a lot

EDIT

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

The seventh line is the void my_ch() line


Solution

  • Something is unfinished in ch.h. Maybe something like a function prototype with a missing semicolon at the end. What is in ch.h?