c-警告:函数的隐式声明‘;printf’;
我知道以前有人问过很多类似的问题,但我找不到解决我收到的警告的方法:c-警告:函数的隐式声明‘;printf’;,c,C,我知道以前有人问过很多类似的问题,但我找不到解决我收到的警告的方法: MyIntFunctions.c:19:2: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 发生在以下位置: void IntPrint (const void *key) { printf("%d", *(int*)key); // line 19 printf("\t-->\t
MyIntFunctions.c:19:2: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
发生在以下位置:
void IntPrint (const void *key)
{
printf("%d", *(int*)key); // line 19
printf("\t-->\t");
}
以及类似的警告:
MyStringFunctions.c:22:2: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
void StringPrint (const void *key)
{
printf("%s",(char*)key); //line 22
printf("\t-->\t");
}
我真的很想知道哪里出了问题,所以我以后不会再这样做了。您需要包含适当的标题
#include <stdio.h>
#包括
如果您不确定标准函数在哪个标题中定义,函数的标题将说明这一点。您需要包含
printf()
函数的声明
#include <stdio.h>
#包括
隐式声明的警告或错误是编译器需要函数声明/原型
它可能是头文件或您自己的函数声明..
您是否考虑过<代码> <代码>请告诉我们如何包含头文件。