Skip to main content
Visitor II
July 2, 2024
Question

Compiler Error During build when i used file concept (fopen and fprintf) to write into file

  • July 2, 2024
  • 3 replies
  • 1265 views

Hi All,

Need one help.
When I try write to file using fopen / fwrite functions in debug mode I receive like
Error: L6200E: Symbol __stdout multiply defined (by stdio_streams.o and my_lib.a)

not enough information to list the image map
while building the code. and how I can solve it. 

    This topic has been closed for replies.

    3 replies

    Super User
    July 2, 2024

    @shekharsulgiti wrote:

    Error: L6200E: Symbol __stdout multiply defined (by stdio_streams.o and my_lib.a)


    You're using Keil, aren't you?

    "multiply defined" is their clumsy way of saying that you have multiple definitions of __stdout

    As this is specific to Keil - not really to do with STM32 - you'd be better asking them:

    https://community.arm.com/support-forums/f/keil-forum

     

    (BTW: it's not a Compiler error - it's a Linker error)

     

    EDIT:

    The message tells you where  the multiple definitions are:

    1. in stdio_streams.o;
    2. in my_lib.a

    So you need to decide which one of them is the one you want, and get rid of the other one.

    Presumably, a library with a name like "my_lib" is something you wrote yourself? If so, consider whether it should be defining __stdout ... ?

    ST Employee
    July 2, 2024

    Hello @shekharsulgiti 

    If you need both libraries and they must contain the definition of __stdout, you may need to modify the linker script to resolve the symbol conflict. This can be complex and depends on your specific toolchain and build system.

    Graduate II
    July 2, 2024

    There's not file system here, are you attempting semi-hosting, or what exactly?

    Super User
    July 2, 2024

    Is this how Keil does UART output from printf?