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

标签 c

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

我正在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/

相关文章:

c - 使用自身元素初始化数组的一些问题

c - 在 C 中执行文件操作时,数字被 append 而不是被添加到 int 变量中

c# - C 指针结构 - buffer 指向另一个结构。如何在 C# 中?

c - C 中的多线程目录工作

python - 将 ctypes 字节数组转换为 float 的 Python 列表

c - 如何在linux内核模式下获取字符串和字符串长度?

c - wcsstr 不区分大小写

c - 以下程序的输出

c - 在 C 中转置矩阵

c - 了解管道、重定向和 IPC