Keil Logo

BL51: Warning 1 (Unresolved External Symbol) Using SBITs


Information in this article applies to:

  • C51 Version 5.50a and later

QUESTION

I want to use a bit of Port P1 for a chip select line. I have declared the chip select as follows:

sbit CS=P1^4;

In a second module I need to access this SFR, so I declare it as an extern:

extern bit CS;

When I link, I receive the following linker error:

Warning L1: Unresolved External Symbol
Symbol: CS
Module: second module name

Where have I made a mistake?

ANSWER

Unfortunately, you can't declare sbits as extern. You must declare the sbit in each C file (or create a header file for it). Just include the SBIT definition you already have in each file.

MORE INFORMATION

  • Review the REG??.H include files in the \C51\INC directory for examples of how you can declare SFRs in an include file.
  • Refer to Warning L1 in the BL51 User's Guide.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.