Search code examples
cgcccompiler-errorsgcc-4.2

"Expected function body after function declarator " compiled using GCC in Terminal


I am trying to compile following program using GCC in terminal

//
//  fileCopy.c
//  
//
//  Created by Saurabh Saini on 14/02/18.
//
#include <stdio.h>

int main(){

int c;
c = getchar();

if(c!=EOF){
    putchar(c);
    c = getchar();
}
return 0;
}

getting the following error enter image description here

I need to understand what is

<U+0010> 

Solution

  • <U+0010> is here indicating that: Unicode character with value 0x10(hexadecimal; 16 in decimal).

    <U+0010> is called DATA LINK ESCAPE(DLE)

    The error is due to this character. Since <U+0010> is a control character hence it is not being ignored by gcc compiler(whitespace charecters are ignored by gcc compiler) so, it is creating compilation error. Remove this character from your source file and it will solve the problem.

    Note: <U+0010> is non printable character so you can't see it. You need to use some hex-editor editor. You can use vim editor. See here and here about how to use it.