I developed an application for the ARM7 embedded system in C. Now I want to compile and link it with C ++ in order to use some C ++ functions. For this, I use mipsel-elf-g++ instead of mipsel-elf-gcc . I can compile my code with mipsel-elf-g++ successfully, but at the linking stage I get errors:
/opt/mipsel/lib/gcc/mipsel-elf/3.4.6/../../../../mipsel-elf/lib/libc.a(lib_a-abort.o): In the function ```abort': /cygdrive/d/Files/cross/mips/newlib-1.15.0/newlib/libc/stdlib/abort.c:63: undefined reference to _exit'`
/opt/mipsel/lib/gcc/mipsel-elf/3.4.6/../../../../mipsel-elf/lib/libc.a(lib_a-signalr.o): In the function ```_kill_r': /cygdrive/d/Files/cross/mips/newlib-1.15.0/newlib/libc/reent/signalr.c:61: undefined reference to kill'`
collect2: ld returned 1 exit status
I searched for this problem and found that I had to implement my own _exit and kill functions, so I added these codes to my project:
void _exit(int code) { while(1); } int _DEFUN (kill, (pid, sig), int pid _AND int sig) { if(pid == __MYPID) _exit(sig); return 0; }
By adding these two functions, the undefined reference to the `_exit 'error is fixed, but the undefined reference to the` kill' error still exists.
What should I do to fix this problem?
source share