exit.c:(.text.exit+0x1a): undefined reference to `_exit' error in Eclipse

Asked by Sagar

I am using ARM-GNU-Eclipse plugin to build code for arm7 mcu.in mac os x 11.1

but i am getting error.

exit.c:(.text.exit+0x1a): undefined reference to `_exit'

my console output is

make all
Building target: lpc.elf
Invoking: Cross ARM C Linker
arm-none-eabi-gcc -mcpu=arm7tdmi -mthumb -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g -Xlinker --gc-sections -Wl,-Map,"lpc.map" -o "lpc.elf" ./main.o
/usr/local/gcc-arm/gcc-arm-none-eabi-4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x1a): undefined reference to `_exit'
collect2: error: ld returned 1 exit status
make: *** [lpc.elf] Error 1

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Thomas Preud'homme
Solved:
Last query:
Last reply:
Revision history for this message
Andre Vieira (andre-simoesdiasvieira) said :
#1

Hi Sagar,

Try adding '-specs=rdimon.specs' to your compile command. That will link in all your compiler runtime code.

Best Regards,

Revision history for this message
Sagar (sam-sojitra) said :
#2

where should i add that command..?? i mean in settings..?? or which location in IDE.

Revision history for this message
Best Thomas Preud'homme (thomas-preudhomme) said :
#3

Hi Sagar,

There should be a settings in the IDE to enter the link flags you want to use. On the Eclipse I have it's in Project > Properties > C/C++ Build > Settings > GCC C Linker > Miscellaneous but it might be different for you. You would have better luck finding this information on the website where you downloaded that plugin.

Best regards.

Revision history for this message
Sagar (sam-sojitra) said :
#4

Thanks Thomas Preud'homme, that solved my question.