error: expected declaration or statement at end of input in c

Normally that error occurs when a } was missed somewhere in the code, for example:

void mi_start_curr_serv(void){
    #if 0
    //stmt
    #endif

would fail with this error due to the missing } at the end of the function. The code you posted doesn't have this error, so it is likely coming from some other part of your source.


For me this problem was caused by a missing ) at the end of an if statement in a function called by the function the error was reported as from. Try scrolling up in the output to find the first error reported by the compiler. Fixing that error may fix this error.


You probably have syntax error. You most likely forgot to put a } or ; somewhere above this function.


For me it was a missing } bracket in a function called by the code where the error was reported. Was also reported on code calling the function that called the function missing the }. So can be hard to find if you do not know what you are looking for.

Tags:

C