打印

求助! ,解决CCS3.3编译出问题

[复制链接]
1540|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
lijianmin|  楼主 | 2015-9-8 13:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求助! ,解决CCS3.3编译出问题

ccs3.3环境下使用了malloc函数,编译出错!

#include "stdlib.h"

int *p;
p=(int *)malloc(100 * sizeof(int));
。。。

"main.c", line 45: error: this declaration has no storage class or type specifier
"main.c", line 45: error: declaration is incompatible with "int *pppp" (declared at line 44)
"main.c", line 45: error: function call is not allowed in a constant expression
"main.c", line 45: error: expression must have arithmetic or pointer type



相关帖子

沙发
lijianmin|  楼主 | 2015-9-8 13:08 | 只看该作者
本人使用F2811芯片,需要的RAM较大,必须使用到.esysmem段,malloc()函数分配的空间在此段。
ccs3.3环境下总是出错,请大侠帮忙解决。

使用特权

评论回复
板凳
lijianmin|  楼主 | 2015-9-8 14:17 | 只看该作者
问题已经解决,malloc()函数要放在所有定义变量之后使用后,编译通过。

使用特权

评论回复
地板
401319719| | 2015-9-13 20:12 | 只看该作者
学习

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

5

帖子

0

粉丝