Linkage Conflict - variable redefinition - CW 6.3

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Linkage Conflict - variable redefinition - CW 6.3

ソリューションへジャンプ
5,732件の閲覧回数
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 解決策
4,299件の閲覧回数
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 返答(返信)
4,300件の閲覧回数
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 件の賞賛
返信
4,299件の閲覧回数
ignisuti
Contributor IV

Duh... I'm embarassed now.

 

Thanks Kef!

0 件の賞賛
返信