简体   繁体   中英

“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 在此处输入图片说明

I need to understand what is

<U+0010> 

<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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM