Linkage Conflict - variable redefinition - CW 6.3

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linkage Conflict - variable redefinition - CW 6.3

Jump to solution
4,270 Views
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?

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
2,837 Views
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.

View solution in original post

0 Kudos
Reply
2 Replies
2,838 Views
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 Kudos
Reply
2,837 Views
ignisuti
Contributor IV

Duh... I'm embarassed now.

 

Thanks Kef!

0 Kudos
Reply