Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Keil。我有以下文件“Driver.h”和“Driver.c”。
驱动程序.h
extern static int Status[5];
我知道上面的说法是错误的。全局声明时静态更改的含义。但是,我仍然想声明一个变量,它是一个数组。它应该可以被另一个文件使用,并且它应该具有不应该改变值的范围,除非我们改变它。
驱动程序.c
整数状态[5]={0x00,0x00,0x00,0x00,0x00};
错误消息如下所示。
错误 C28:多个存储类
你能帮我么?
删除static, 以声明一个位于外部的数组。然后确保项目中的一个 C 文件确实定义了它,使用int Status[5];.
static
int Status[5];
不确定您所说的“除非我们更改它,否则它应该具有不应更改的值的范围”,当然,除非您更改它,否则它不会更改......它将是全局的,从所有模块和函数中可见程序。