Ç - 警告:函数'printf“式的隐式声明 [英] c - warning: implicit declaration of function ‘printf’

查看:440
本文介绍了Ç - 警告:函数'printf“式的隐式声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有很多类似的问题以前问过,但我无法找到的东西,会解决这个警告,我得到:

I know alot of similar questions were asked before but i couldn't find something that would fix this warning i get:

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");
}

我真的想了解什么是错的,所以我不会在将来再次做到这一点。

I really want to understand what is wrong so i won't do that again in the future.

推荐答案

您需要包括相应的​​头

You need to include the appropriate header

#include <stdio.h>

如果你不知道这头一个标准功能是,该功能的手册页中定义会说明这一点。

If you're not sure which header a standard function is defined in, the function's man page will state this.

这篇关于Ç - 警告:函数'printf“式的隐式声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆