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

simple printf causes L103 linker error

I haven't received an answer that fixed my problem, so here is another example.

I have a simple printf statement that causes a L103 error. No variables declared. Includes "stdio.h" and links in C51FPL.LIB. Others LIBs don't seem to link correctly either. Code compiles fine. Anyone know what the linking problem could be?

#include "stdio.h"

main()
{ printf("12345");
}

BL51 BANKED LINKER/LOCATER V5.12
COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2004

*** ERROR L103: EXTERNAL ATTRIBUT DO NOT MATCH PUBLIC SYMBOL: ?_PRINTF?BYTE MODULE: C51FPL.LIB (PRINTF)

Program Size: data=15.1 xdata=48 code=2562
LINK/LOCATE RUN COMPLETE. 0 WARNING(S), 1 ERROR(S)

  • Are you MANUALLY forcing the library that the link should link with?

    If so, that may be the problem.

    The compiler tells the linker which Keil libraries to include so there is no need for you to do that.

    For example, C51S.LIB is the small model library. C51FPS.LIB is the small model library floating-point extensions. To link a small model application with floating-point, you need both of these libraries linked in. Note that the compiler and linker do this automatically and there is no need for you to do anything.

    If you get the problems you get when using the command line to compile and build but you don't get them when you use uVision, then you should tell uVision to create a batch file for building the project and you should review that to see what the differences are.

    Jon

  • Jon,

    You're a genius. That was the problem. I was manually linking a particular LIB. I used to have to do that with the old Keil software and just ported it over to the new project. If I take out the LIB from my link, all memory models link fine. Thanks.

    Sutton