求助:出现错误multiple storage classes in declaration of 'rdbmsState'

cugege 2003-09-12 04:04:07
开发语言: C
操作系统:UNIX

我在文件a.c中使用了"static int rdbmsState = 0;",在另外一个文件b.c中使用了
"extern static int rdbmsState;",但是编译时出现如下错误:

b.c:172: multiple storage classes in declaration of `rdbmsState'
*** Error code 1
make: Fatal error: Command failed for target `b.o'

请赐教如何修改。
谢谢!

...全文
13671 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhumerchant 2003-09-12
  • 打赏
  • 举报
回复
MSDN上的解释:
“When modifying a variable or function at file scope, the static keyword specifies that the variable or function has internal linkage (its name is not visible from outside the file in which it is declared).”
用static修饰一个变量或者函数时,表示该名字只能在文件内部使用,文件外部是看不到该名字的。
louguoqiang 2003-09-12
  • 打赏
  • 举报
回复
b.c中的extern static int rdbmsState;
改为
extern int rdbmsState;

24,852

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧