gpt4 book ai didi

c - 消息 "warning: implicit declaration of function"

转载 作者:行者123 更新时间:2023-11-30 16:46:18 25 4
gpt4 key购买 nike

我的编译器(GCC)向我发出警告:

warning: implicit declaration of function

为什么会来?

最佳答案

您正在使用编译器尚未看到其声明(“原型(prototype)”)的函数。

例如:

int main()
{
fun(2, "21"); /* The compiler has not seen the declaration. */
return 0;
}

int fun(int x, char *p)
{
/* ... */
}

您需要在 main 之前声明您的函数,如下所示,直接声明或在 header 中声明:

int fun(int x, char *p);

关于c - 消息 "warning: implicit declaration of function",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43825890/

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