gpt4 book ai didi

c - 函数的隐式声明 ‘mygets’ [-Wimplicit-function-declaration] mygets(str1);

转载 作者:行者123 更新时间:2023-11-30 20:34:17 24 4
gpt4 key购买 nike

[我一直在研究其他问题,但没有一个解决方案有效,所以我会问我自己的问题。

我正在Ubuntu Kylin16.04(中国版)上工作,编译我的代码时遇到问题,这是我的gets函数,编译器收到的错误] 1

最佳答案

函数的隐式声明意味着您通常在头文件中没有函数引用。

或者也许你有它,但是调用你的函数的文件看不到它。

//Declaration, must always be before first function call
void myfunc(void);

//Function usage somewhere in the code
int main(void) {
//Call it here, compiler see the reference and knows what type
//of func it is and what parameters should be used to func
myfunc();
}

//Definition, write function content here
//This part will be compiled in separate way, linked will put everything together
void myfunc(void) {
//Write function content here
}

关于c - 函数的隐式声明 ‘mygets’ [-Wimplicit-function-declaration] mygets(str1);,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42954363/

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