//数据定义
extern static u16 AD_Vtemp[10];//装载10次ADC采样数据
extern static u16 AD_val; //ADC单次采样数据
出现了这样的错误
MAIN.C(8): error C141: syntax error near ‘static’
MAIN.C(9): error C141: syntax error near ‘static’
下面是C语言标准:
If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined.
而引用
For an identifier declared with the storage-class specifier extern in a scope in which a prior declaration of that identifier is visible, if the prior declaration specifies internal or external linkage, the linkage of the identifier at the later declaration is the same as the linkage specified at the prior declaration. If no prior declaration is visible, or if the prior declaration specifies no linkage, then the identifier has external linkage.
所以先出现 extern 后出现 static 是不行的,用extern外部声明即可
//数据定义
extern u16 AD_Vtemp[10];//装载10次ADC采样数据
extern u16 AD_val; //ADC单次采样数据
改成如上后,编译通过