gpt4 book ai didi

c - 未找到 fatal error 'stdio.h'

转载 作者:行者123 更新时间:2023-12-02 06:22:59 31 4
gpt4 key购买 nike

为什么我会收到这条消息?编译器是叮当的。这是一个简单的程序,为了举例,它发生了:

#include<stdio.h>

int fib(int);
int main()
{
int i;
scanf("%d",&i);
printf("The fibonacci number that is %i'th in the sequence is %i \n", i, fib(i));
return 0;
}

int fib(int n)
{
if (n==1 || n==0) return 1;
else return fib(n-1)+fib(n-2);
}

最佳答案

假设 C
<stdio.h> 是标准的 C 头文件之一。您的编译器提示它找不到这个头文件。这意味着您的标准库已损坏。

考虑重新安装编译器。

假设 C++
<stdio.h> 是 C 标准头文件,在 C++ 中我们使用 <cstdio> 代替。尽管 <stdio.h> 仍然需要在 C++ 中存在,所以这可能不是问题。

除了这些假设之外,似乎(根据您的编码风格和标签)您最有可能使用 C。试试这个作为一些示例代码。这(由我)保证可以在工作的 C 编译器上编译,如果没有,那么你的编译器会严重损坏,你必须安装另一个/重新安装:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
printf("Hello World!\n");
return EXIT_SUCCESS;
}

关于c - 未找到 fatal error 'stdio.h',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5898199/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com