This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

modifying putchar, and watching the prinf source code

In http://www.keil.com/support/docs/788.htm you described how to change the putchar function.
I have coppied PUTCHAR.C to the project directory, and added it to the project source files (using uVision2). As soon as I started to re-build the project, the following error occured:


Build target 'Target 1'
compiling SIO.C...
compiling MAIN.C...
compiling PUTCHAR.C...
linking...
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
SYMBOL: _PUTCHAR
MODULE: .\output\PUTCHAR.obj (PUTCHAR)
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?_PUTCHAR?PUTCHAR
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: _PUTCHAR
MODULE: C:\KEIL\C51\LIB\C51S.LIB (PRINTF)
ADDRESS: 0080H
*** ERROR L118: REFERENCE MADE TO ERRONEOUS EXTERNAL
SYMBOL: _PUTCHAR
MODULE: C:\KEIL\C51\LIB\C51S.LIB (GETCHAR)
ADDRESS: 06E2H
Program Size: data=50.3 xdata=0 code=1780
Target not created

Why ? Where else is putchar defined ? what can I do in order to change putchar ?

Another question is where can I see the source code of printf ?

Thanks,
Amit.

Parents
  • linking...
    *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL: _PUTCHAR
    MODULE: .\output\PUTCHAR.obj (PUTCHAR)
    As I've noted before, this Linker messages is not very helpful - it is complaining about multiple definitions, but it lists only one definition!
    http://www.keil.com/forum/docs/thread1666.asp

    It would be far more useful if the message listed all modules containing the offending symbol; eg,
    *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL: VARIABLE_NAME
    MODULE: File_Name1.obj (FILE_NAME)
    MODULE: File_Name2.obj (FILE_NAME)
    Again, Borland manages this.

Reply
  • linking...
    *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL: _PUTCHAR
    MODULE: .\output\PUTCHAR.obj (PUTCHAR)
    As I've noted before, this Linker messages is not very helpful - it is complaining about multiple definitions, but it lists only one definition!
    http://www.keil.com/forum/docs/thread1666.asp

    It would be far more useful if the message listed all modules containing the offending symbol; eg,
    *** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL: VARIABLE_NAME
    MODULE: File_Name1.obj (FILE_NAME)
    MODULE: File_Name2.obj (FILE_NAME)
    Again, Borland manages this.

Children