Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


linker error: multiple definition of `putchar

Posted by Andriy Korud on June 4, 2009
I'm trying to compile FreeRTOS 5.3.0 STM32 Primer example (unmodified). RIDE and development environment is fresh and clear:

Everything compile fine, except linking:
Running: LD
\"C:\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-gcc.exe" -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker "C:\work\FreeRTOS\Demo\CORTEX_STM32F103_Primer_GCC\RTOSDemo.elf.ld" -u _start -Wl,-static -Wl,--gc-sections -nostartfiles -Wl,-Map -Xlinker "C:\work\FreeRTOS\Demo\CORTEX_STM32F103_Primer_GCC\RTOSDemo.map"
C:\Raisonance\Ride\Lib\ARM\STM32x_io_putchar_thumb.a(STM32F10X_IO_putchar.o): In function `putchar':
STM32F10X_IO_putchar.c:(.text.putchar+0x0): multiple definition of `putchar'
c:/raisonance/ride/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/lib/thumb2\libc.a(lib_a-putchar.o):putchar.c:(.text+0x0): first defined here
collect2: ld returned 1 exit status

The I have no idea how to prevent linker from linking libc putchar, any ideas?


RE: linker error: multiple definition of `put

Posted by Richard on June 4, 2009
The error is telling you where to two definitions are. One is in the libc library, and the other in STM32F10X_IO_putchar.c - so you need to either remove the .c file from the build or not use the library. I suspect this is a compiler or link option setting problem and must be caused by a different Ride version to the one used to create the demo.


RE: linker error: multiple definition of `putchar

Posted by Andriy Korud on June 4, 2009
Thanks, it's exactly I supposed.
The problem that I have no idea how to avoid linking libc - it's linked automatically. And worse, I want libc - there are many useful function there. And the goal is to use both - putchar from STM32F10X_IO_putchar.c and libc for the rest.
Any ideas? Maybe I'm wrong somewhere?


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner