关于 implicit declaration of function Which should not record for myself

用gcc编译c程序的时候 经常会出现
implicit declaration of function '...' 的warning

偶经过这几天的经验,发现主要有2种情况会产生这种warning

1   没有把函数所在的c文件生成.o目标文件
2   在函数所在的c文件中定义了,但是没有在与之相关联的.h文件中声明

第二种情况如此:

camif_fsm.c中的函数定义:

void camif_start_c_with_p(camif_cfg_t *cfg, camif_cfg_t *other)
{
// cfg->gc->other = get_camif(CODEC_MINOR);
cfg->gc->other = other;
camif_start_p_with_c(cfg);
}

该函数的声明未包含在camif.h文件中,这样在调用此函数时由于camif_start_p_with_c(cfg)函数的定义在此函数之前,故产生此错误:warning: implicit declaration of function `camif_start_c_with_p'


So the problem is the include file should exist in .c and .h files...

原文地址:https://www.cnblogs.com/shaoguangleo/p/2805743.html