首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

隐式声明与内建函数不兼容,是咋回事

2012-11-11 
隐式声明与内建函数不兼容,是怎么回事?我在用gcc4编译一个C程序时出现如下警告,请问大家是怎么回事?In fil

隐式声明与内建函数不兼容,是怎么回事?
我在用gcc4编译一个C程序时出现如下警告,请问大家是怎么回事?
In file included from test-sqlist.c:7:
sqlist.h: 在函数 ‘initlist_sq’ 中:
sqlist.h:61: 警告:隐式声明与内建函数 ‘malloc’ 不兼容
sqlist.h:63: 警告:隐式声明与内建函数 ‘exit’ 不兼容
sqlist.h: 在函数 ‘listinsert_sq’ 中:
sqlist.h:148: 警告:隐式声明与内建函数 ‘exit’ 不兼容

sqlist.h是我自己写的一个头文件,59-67行是如下 函数:
status initlist_sq(sqlist *L_add)// typedef status int
{
L_add->elem = (elemtype *)malloc(LIST_INIT_SIZE * sizeof(elemtype));
if (!L_add->elem)
exit(OVERFLOW);// #define OVERFLOW -2
L_add->length = 0;
L_add->listsize = LIST_INIT_SIZE;
return OK;
} // initlist_sq

146-153行如下:
if (L_add->length >= L_add->listsize) {// 当前存储空间已满, 增加分配
newbase = (elemtype *)realloc(L_add->elem, 
(L_add->listsize + LISTINCREMENT) * sizeof(elemtype));
if (!newbase)// fail to allocate
exit(OVERFLOW);
L_add->elem = newbase;
L_add->listsize += LISTINCREMENT;
}


[解决办法]
就是你没包含stdlib.h文件咯
[解决办法]
少头文件
[解决办法]
我也觉得是像少了#include <stdlib.h>
[解决办法]
我也认为可能少了#include <stdlib.h>

热点排行