linker error: multiple definition of `putchar
Hi,
I’m trying to compile FreeRTOS 5.3.0 STM32 Primer example (unmodified). RIDE and development environment is fresh and clear:
Ride7 7.20.09.0139
Rkit-ARM 1.20.09.0153
Everything compile fine, except linking:
Running: LD
"C:RaisonanceRidearm-gccbinarm-none-eabi-gcc.exe" -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker "C:workFreeRTOSDemoCORTEX_STM32F103_Primer_GCCRTOSDemo.elf.ld" -u _start -Wl,-static -Wl,–gc-sections -nostartfiles -Wl,-Map -Xlinker "C:workFreeRTOSDemoCORTEX_STM32F103_Primer_GCCRTOSDemo.map"
C:RaisonanceRideLibARMSTM32x_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/thumb2libc.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?
Regards,
Andriy
linker error: multiple definition of `putchar
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.
Regards.
linker error: multiple definition of `putchar
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?
regards,
Andriy