multiple definition of '_malloc_r'

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

multiple definition of '_malloc_r'

1,469 次查看
mstuehn
Contributor I

Hi,

I'm trying to build a C++ MQX 4.1.1 application on the TWR-VF65GS10_M4 (ARM-GCC 4_8-2014q1 and eclipse Luna 4.4.0). But it ends with the following error message:

gcc-arm-none-eabi-4_8-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-mallocr.o): In function `_malloc_r':

mallocr.c:(.text._malloc_r+0x0): multiple definition of `_malloc_r'

MQX_4_1_1_LINUX_GA/mqx/source/psp/cortex_m/compiler/gcc_arm/comp.c:94: first defined here

Having a look into the provided makefiles (the mentioned project is an eclipse-based project), i found the following option in the linker-flags:

-Xlinker -z -Xlinker muldefs

If i use this linkerflag in my eclipse-project also the project compiles and links. But i would like to not use this scary linkerflag. How can i avoid this linkerflag?

Thanks.

0 项奖励
1 回复

866 次查看
alejandrolozan1
NXP Employee
NXP Employee

Hi,

As a matter of fact I believe that you need those linker flags. The MQX code implements a few functions that already defined and implemented in arm-gcc freestanding compiler.

What we need is to overwrite the compiler definitions of those functions. This is achieved by the previously mentioned linker flags.

Best Regards,

Alejandro

0 项奖励