内置函数‘malloc’的不兼容隐式声明 [英] Incompatible implicit declaration of built-in function ‘malloc’

查看:56
本文介绍了内置函数‘malloc’的不兼容隐式声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误:

警告:内置函数‘malloc’的隐式声明不兼容

warning: incompatible implicit declaration of built-in function ‘malloc’

我正在尝试这样做:

fileinfo_list* tempList = malloc(sizeof(fileinfo_list));

手头使用的结构仅供参考:

Just for the reference the struct used at hand is:

typedef struct {
    fileinfo** filedata;
    size_t nFiles;
    size_t size;
    size_t fileblock;
} fileinfo_list;

我认为我所做的没有任何问题.我只是创建了一个 tempList,大小为 1 x fileinfo_list.

I don't see anything wrong with what I've done. I'm just creating a tempList with the size of 1 x fileinfo_list.

推荐答案

你可能忘记了 #include

这篇关于内置函数‘malloc’的不兼容隐式声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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