*** ERROR 118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: ~~~
MODULE: ~~~
ADDRESS: ~~~
구글에 검색을 해본 결과 다음과 같은 이유를 찾아 내었다.
BL51: ERROR 118 (ERRONEOUS REFERENCE TO EXTERNAL VARIABLES)
Information in this support solution applies to:
- C51 All Versions
QUESTION
The following C file (C:\MYCODE\J1.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:\MYCODE\J1.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.
그런데 원래 C는 대소문자를 구별하는 것으로 알고 있는데... OMF-51 포맷 즉 8051 컴파일러에서 전역 변수일 경우 대문자로 시작을 하고 왠만하면 이름을 같은것으로 하지 않는것이 나을거 같다.
OMF-51 object module format specified by Intel의 다운로드는 ==> http://www.keil.com/download/docs/80.asp
'예전글 목록' 카테고리의 다른 글
Middleware for Sensor Network (0) | 2007.10.27 |
---|---|
AVR Small Rtos (0) | 2007.10.26 |
[6lowpan] RFC 4944 now available (0) | 2007.09.26 |
네이트온 리눅스 설치 (0) | 2007.09.22 |
회사 상사분 결혼식. (0) | 2007.09.01 |