This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warnings L1 and L2

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;

and I put this in another file trying to access that variable:

extern bit var1;

I know that the files can "see" each other because other "Public" variables in these files work fine. Also, P1 is specified in the include REG51.H file. Is my syntax wrong?

Parents
  • 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.

Reply
  • 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.

Children
No data