Linkage Conflict - variable redefinition - CW 6.3

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Linkage Conflict - variable redefinition - CW 6.3

跳至解决方案
4,338 次查看
ignisuti
Contributor IV

I'm getting the following when I compile:

Warning : external/internal linkage conflict with previous declaration
HARDWARE.c line 52   static unsigned char digitalInput1TimerEnable = FALSE;

 I have a file named HARDWARE.c that contains this line of code:

static unsigned char digitalInput1TimerEnable = FALSE;

and also a HARDWARE.h header file that contains this line of code:

extern unsigned char digitalInput1TimerEnable;

 This variable is not defined anywhere else in my code. Why would I be getting this warning?

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
2,905 次查看
kef
Specialist I

static variables can not be exported to other C files with extern. static's are always private to the C file, you define them in. Either remove static keyword from variable definition or extern from declaration. Your favorite C book should tell you the same.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
2,906 次查看
kef
Specialist I

static variables can not be exported to other C files with extern. static's are always private to the C file, you define them in. Either remove static keyword from variable definition or extern from declaration. Your favorite C book should tell you the same.

0 项奖励
回复
2,905 次查看
ignisuti
Contributor IV

Duh... I'm embarassed now.

 

Thanks Kef!

0 项奖励
回复