您的位置:首页 > 其它

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

2011-10-08 15:50 417 查看
用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...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐