CCS4下C语言使用malloc.h内的函数编译不通过

[复制链接]
2818|25
 楼主| Erichk 发表于 2018-1-25 16:35 | 显示全部楼层 |阅读模式
大神们,现在遇到一个问题。
我在CCS下C语言使用malloc.h内的函数编译不通过,
代码:#include <malloc.h>
1. could not open source file "malloc.h"
2. 若注销掉此行,则其内所有内存操作函数如malloc();等都不能使用了;

请问下这是什么原因,怎么解决?我使用的是CCS4
Thorald 发表于 2018-1-25 16:57 | 显示全部楼层
在CCSv4下,你需要将malloc.h的位置指定正确,请参考如下
\Texas Instruments\ccsv4\simulation\bin\components\photon\gcc\include\malloc.h
Bjorn 发表于 2018-1-25 19:54 | 显示全部楼层
可以的啊,你怎么写的?

需要设定--heap_size和使用
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
Rollo 发表于 2018-1-25 20:05 | 显示全部楼层

不需要malloc.h 也可以用malloc函数 而ccs并没有malloc 我用V5没有找到该头函数
kkzz 发表于 2018-1-25 22:38 | 显示全部楼层
说明没有这个文件存在的。
hudi008 发表于 2018-1-25 22:38 | 显示全部楼层
stdlib.h文件呢?
lzmm 发表于 2018-1-25 22:41 | 显示全部楼层
在“stdlib.h”头文件中
minzisc 发表于 2018-1-25 22:42 | 显示全部楼层
stdlib.h 和 malloc.h 中都有吧
selongli 发表于 2018-1-25 22:42 | 显示全部楼层
使用stdlib.h头文件
kkzz 发表于 2018-1-25 22:51 | 显示全部楼层
你的CCS是怎么设置的?
hudi008 发表于 2018-1-25 22:51 | 显示全部楼层
需要把文件路径添加上。
lzmm 发表于 2018-1-25 22:51 | 显示全部楼层
这个内存分配没有使用过。
minzisc 发表于 2018-1-25 22:51 | 显示全部楼层
试试另外一个库函数。
selongli 发表于 2018-1-25 22:51 | 显示全部楼层
可能你没有包含这个路径。
ayb_ice 发表于 2018-1-26 10:18 | 显示全部楼层
复制到项目文件夹里也可以
vivilzb1985 发表于 2018-1-31 23:04 | 显示全部楼层
这个需要添加相关的库函数的
jkl21 发表于 2018-2-6 20:51 | 显示全部楼层
#include <stdlib.h>
maqianqu 发表于 2018-2-6 20:51 | 显示全部楼层
没有添加上路径。
dspmana 发表于 2018-2-6 20:52 | 显示全部楼层
是不是CCS有问题
eefas 发表于 2018-2-6 20:52 | 显示全部楼层
可能路径不存在。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

99

主题

500

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部