当前位置: 技术问答>linux和unix
在LINUX下编译hello.c报错
来源: 互联网 发布时间:2015-12-08
本文导语: 程序是hello.c: int main(int argc,char **argv) { printf("Hello Linuxn"); } 编译:gcc -o hello hello.c 报错:hello.c:1: stray '241' in program hello.c:1: stray '241' in program hello.c:1: stray '241' in program hello.c:1: stray '241' i...
程序是hello.c:
int main(int argc,char **argv)
{
printf("Hello Linuxn");
}
编译:gcc -o hello hello.c
报错:hello.c:1: stray '241' in program
hello.c:1: stray '241' in program
hello.c:1: stray '241' in program
hello.c:1: stray '241' in program
hello.c:2: stray '241' in program
hello.c:2: stray '241' in program
hello.c:2: stray '241' in program
hello.c:2: stray '241' in program
hello.c: In function `main':
hello.c:3: stray '241' in program
hello.c:3: stray '241' in program
hello.c:3: stray '241' in program
hello.c:3: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4:6: warning: no newline at end of file
int main(int argc,char **argv)
{
printf("Hello Linuxn");
}
编译:gcc -o hello hello.c
报错:hello.c:1: stray '241' in program
hello.c:1: stray '241' in program
hello.c:1: stray '241' in program
hello.c:1: stray '241' in program
hello.c:2: stray '241' in program
hello.c:2: stray '241' in program
hello.c:2: stray '241' in program
hello.c:2: stray '241' in program
hello.c: In function `main':
hello.c:3: stray '241' in program
hello.c:3: stray '241' in program
hello.c:3: stray '241' in program
hello.c:3: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4: stray '241' in program
hello.c:4:6: warning: no newline at end of file
|
那是因为你是从WINDOWS中把这个HELLO程序拷到VI里了吧,这个里面包含了VI不认识的一些字符,所以会编译(注意)出错了,自己重写一下就不会有问题了。
|
用手打几个字符不是很麻烦吧?
以后最好是转一下
以后最好是转一下
|
如果你用vi编辑并手工输入源代码的话,估计一次性就通过了。
对了,源文件尾部最好留一个空行。
对了,源文件尾部最好留一个空行。
|
od一下你的程序文件.
看看是不是有r了.
在linux里换行是n
在windows里是rn
看看是不是有r了.
在linux里换行是n
在windows里是rn