我想用C编写和运行“Hello World”的stdio.h文件错误?
int main(int argc, char *argv[])
{
#include <stdio.h>
puts("Hello world.");
return 0;
}
不过,我不断收到以下错误在终端:
In file included from ex.c:3:
/usr/include/stdio.h:353:54: error: function definition is not allowed here
__header_always_inline int __sputc(int _c, FILE *_p) {
^
1 error generated.
在我看来,它捡stdio头文件中的语法错误?我不明白发生了什么事。
错误出现在您编写的代码中。标准库标题旨在包含在**文件范围**中。 – StoryTeller
'#include'移到'main'之前。定义嵌套函数的错误。 –
BLUEPIXY
_“在我看来,它正在拾取stdio头文件中的语法错误”_...现在,这是... D –