![](/img/trans.png)
[英]C programming basics: Why can't I see the .o file after I compile my .c file with gcc
[英]Why my .c coding can't be compile in GCC?
我在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
有人可以帮我吗?
您会收到这些错误,因为您可能会从格式化的源中复制并粘贴该代码。 “
和“
与”
不一样"
。将它们改为,代码将编译。
您可能还应遵循主要定义为的惯例:
int main(void)
因此返回一个int
。
您可能还想将/ n更改为\\ n
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.