Keil™, An ARM® Company

Technical Support

CARM: L104: MULTIPLE PUBLIC DECLARATION 'GETCHAR'


Information in this article applies to:

  • ARM Development Tools — Any Version

QUESTION

After adding the scanf function to my program code, I now get the following two linker error messages:

*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL:  getchar?T

*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL:  getchar?A

The getchar function is defined in the module SERIAL.C (which I have taken from one of the example projects) and this module is translated using the INTERWORK directive. What causes these errors?

ANSWER

scanf uses the function _getkey as basic input routine. Rename getchar to _getkey as shown below:

int _getkey (void)  {                    /* Read character from Serial Port   */

  while (!(U1LSR & 0x01));

  return (U1RBR);
}

After this, everything should just work fine.

MORE INFORMATION

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, October 18, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure