我想用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 –