我有一些简单的 C 代码:
#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
我该如何修复它?
您收到这些错误是因为您可能是从格式化源复制并粘贴该代码。“
and ”
不一样"
。将它们更改为该代码即可编译。
您可能还应该遵循将 main 定义为的约定:
int main(void)
因此返回一个int
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)