新闻中心

EEPW首页>嵌入式系统>设计应用> 关于keil中编译程序的一些问题

关于keil中编译程序的一些问题

作者: 时间:2016-11-25 来源:网络 收藏
1:当需要申请大量的存储空间时使用这样的方法程序如下:

#ifndef ADC_H
#define ADC_H//头文件内容

本文引用地址://m.amcfsurvey.com/article/201611/321324.htm

extern uchar xdataadc_ua[128];//name = 0x0a
extern uchar xdata adc_ub[128];
extern uchar xdata adc_uc[128];
extern uchar xdata adc_ia[128];
extern uchar xdata adc_ib[128];
extern uchar xdata adc_ic[128];

#endif

以上出现在头文件中,但是在对应的“.c"文件中还需要重新定义(初始化)如下:

uchar xdata adc_ua[128] = {0};//name = 0x0a
uchar xdata adc_ub[128] = {0};
uchar xdata adc_uc[128] = {0};
uchar xdata adc_ia[128] = {0};
uchar xdata adc_ib[128] = {0};
uchar xdata adc_ic[128] = {0};

这样编译器才不会报错

这是因为extern的用法决定的

但是在之前需要设定就几个编译环境如图:



划线的地方需要选择的,这个要注意了


关键词:keil中编译程

评论


技术专区

关闭