We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
What does it mean when you have an "unresolved external symbol"? The manual claims that the variable is not PUBLIC, however, I don't see how that's the case. I am getting warnings L1 and L2 when I put the following line in one file:
sbit var1 = P1 ^ 7;
extern bit var1;
I'm pretty sure that sbit cannot be extern'ed. You have to make an include file that will be loaded into whatever modules you use it in; or alternatively create a function or a macro that manipulates the particular bit you are interested in.
It appears to me that you can extern sbit if you follow the method on page 94 of the C51 compiler manual (under "Bit-addressable Objects"). Unfortunately, I must be doing something wrong because that method doesn't seem to work. (Although, as buggy as this Keil program seems to be, it wouldn't surprise if what I was doing was just what I was supposed to do, and the program just doesn't work...)
Tim wrote: I am getting warnings L1 and L2 when I put the following line in one file:sbit var1 = P1 ^ 7;and I put this in another file trying to access that variable:extern bit var1; Tom replied: I'm pretty sure that sbit cannot be extern'ed. That is true, but note that Tim has correctly used 'extern bit' - not 'extern sbit', so that's not the problem. You have to make an include file It makes no difference to the Linker whether the external declaration is in an include file, or part of the text of the referring source file.