ERRONEOUS REFERENCE TO EXTERNAL VARIABLES
问题:REFERENCE MADE TO ERRONEOUS EXTERNAL
这是某同学在keil里面C51编程时发来的错误信息,搜遍百度发现没有有效的回答,结果在keil官网上写的明明白白.
这是官网解释链接:
里面说
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.
简单翻译一下,就是:为了遵循某个规则,规定所有的全局变量都视为大写(uppercase),所以除了大小写都一样的变量或函数(全局的)在一个工程中出现时,就会发生这样的错误.
解决方案:
很简单,报错提示的symbol就是命名有问题的变量或函数,只要把相似变量/函数名中的一个改个名就可以了~而不是仅仅只有大小写不一样.
最后希望大家都能 0 error(s), 0 warning(s)!