ARM Technical Support Knowledge Articles

ERROR 118 (ERRONEOUS REFERENCE TO EXTERNAL VARIABLES)

Applies to: BL51 Code-banking Linker/Locator

Answer


Information in this article applies to:


QUESTION

The following C file (C:MYCODEJ1.C)...

/*------------------------------------------------------------/*
extern long Junk;
int junk;

void main (void)
{

for (junk = 0; junk < 100; junk++)
  {
  Junk = 1000L * junk;
  }

}
/*------------------------------------------------------------/*

generates the following error when compiled and linked with the Keil 8051 tools:

*** ERROR 118: REFERENCE MADE TO ERRONEOUS EXTERNAL
    SYMBOL:  JUNK
    MODULE:  C:MYCODEJ1.OBJ (J1)
    ADDRESS: 0020H

What is wrong?

ANSWER

Your program is technically correct. The problem lies in the object module format of the object files created by the Keil C Compiler.

The object files are created according to the OMF-51 object module format specified by Intel. This object module format does not allow lowercase variable names. Therefore, all public variables are treated as uppercase. When you create 2 public symbols with the same name but with different cases, the linker complained about ERRONEOUS EXTERNALS.

Change the name of one of the variables to avoid this problem.

MORE INFORMATION

Article last edited on: 2005-07-19 15:13:56

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential