我有在C简单的代码:为什么我的.c编码不能在GCC中编译?
#include <stdio.h>
main()
{
printf(“Hello, world! /n”);
}
,但我不能在GCC编译它。当我尝试编译它时发出警告:
1. gcc hello.c -o hello
2. hello.c: In function 'main:
3. hello.c:4:1: error: stray '\342' in program
4. hello.c:4:1: error: stray '\200' in program
5. hello.c:4:1: error: stray '\234' in program
6. hello.c:4:11: error: 'Hello' undeclared (first use in this function)
7. hello.c:4:11: note: each undeclared identifier is reported only once for each function
it appears in
8. hello.c:4:18: error: 'world' undeclared (first use in this function)
9. hello.c:4:23: error: expected ')' before '!' token
10. hello.c:4:23: error: stray '\342' in program
11. hello.c:4:23: error: stray '\200' in program
12. hello.c:4:23: error: stray '\235' in program
任何人都可以帮助我吗?
你在你的代码具有智能引号(注意的'“'“卷曲”)。 – birryree 2012-04-16 04:20:37
是这些报价,常规报价? – 2012-04-16 04:23:36
您的文件使用UTF-8;序列''\ 342'',''200',''\ 234''映射到十六进制0xE2,0x80,0x9C,这是U + 201C的UTF-8编码左双引号MARK。结尾为''\ 235''的序列为U + 201D右侧双引号。不要使用一个文字处理器,它认为它应该在C中编码时将'''映射到这些标记中;它会驱使你疯狂。 – 2012-06-10 14:27:59