[英]“Expected function body after function declarator ” compiled using GCC in Terminal
I am trying to compile following program using GCC in terminal 我正在尝试在终端中使用GCC编译以下程序
//
// 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>
此处指示: 值为0x10(十六进制;十进制为16)的Unicode字符 。
<U+0010>
is called DATA LINK ESCAPE(DLE)
<U+0010>
被称为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. 由于
<U+0010>
是控制字符,因此它不会被gcc
编译器忽略( 空格字符被gcc
编译器忽略),因此会产生编译错误。 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. 注意:
<U+0010>
是不可打印的字符,因此您看不到它。 You need to use some hex-editor
editor. 您需要使用一些
hex-editor
器。 You can use vim
editor. 您可以使用
vim
编辑器。 See here and here about how to use it. 有关如何使用它的信息,请参见此处和此处 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.