AnsweredAssumed Answered

Linker errors when using the "new" operator

Question asked by Ville Vallinder on Dec 18, 2015
Latest reply on Dec 22, 2015 by Ville Vallinder

Hello Everybody!

 

When I add something like "int* MyInt = new int;" to a C++ project I get the following result:

 

Invoking: Standard S32DS C++ Linker

powerpc-eabivle-g++ -o "Basic_Z4_1.elf" "@Basic_Z4_1.args"  

D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libsupc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()':

/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:67: undefined reference to `_impure_ptr'

/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:67: undefined reference to `_impure_ptr'

/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:69: undefined reference to `_impure_ptr'

/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:72: undefined reference to `_impure_ptr'

/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:49: undefined reference to `_impure_ptr'

D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libsupc++.a(vterminate.o):/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:49: more undefined references to `_impure_ptr' follow

D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(vsnprintf.o): In function `vsnprintf':

S32DS/e200_ewl/EWL_C/src/stdio/vsnprintf.c:58: undefined reference to `__pformatter'

D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(abort.o): In function `abort':

S32DS/e200_ewl/EWL_C/src/stdlib/abort.c:34: undefined reference to `_ExitProcess'

D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(alloc.o): In function `sbrk':

S32DS/e200_ewl/EWL_C/src/stdlib/alloc.c:285: undefined reference to `_end'

S32DS/e200_ewl/EWL_C/src/stdlib/alloc.c:285: undefined reference to `_end'

D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(exit.o): In function `exit':

S32DS/e200_ewl/EWL_C/src/stdlib/exit.c:40: undefined reference to `__fini_cpp'

S32DS/e200_ewl/EWL_C/src/stdlib/exit.c:53: undefined reference to `_ExitProcess'

collect2.exe: error: ld returned 1 exit status

make: *** [Basic_Z4_1.elf] Error 1

 

Does anyone know the reason for this?

 

I have a proprietary implementation of "new" that I could use, is there a way to make DS use that one instead of the built-in one?

 

Thanks in advance!

 

Ville

Outcomes