This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Undefined reference to `_exit' when building blinky

There is a similar case where the user mentions that he fixed his issue by "changing the compiler" with no further explanations.

https://devzone.nordicsemi.com/f/nordic-q-a/30208/exit-c-text-exit-0x16-undefined-reference-to-_exit


I have the same issue.  How do I change the compiler?  To what?

Parents Reply Children
  • Hi Chandra,

    Are you facing the exact same issue? If not please create a new Devzone question with your specs and work environment.

    The _exit "error" is just an induction that one or serval of the the compiling id failed and is not in it self a cause of worry as it will show the same error when it is successfully building a project.

    I included a CMakeError.log from a project that successfully builds.

    Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
    Compiler: C:/gnuarmemb/bin/arm-none-eabi-gcc.exe 
    Build flags: 
    Id flags:  
    
    The output was:
    1
    c:/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
    exit.c:(.text.exit+0x2c): undefined reference to `_exit'
    collect2.exe: error: ld returned 1 exit status
    
    
    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
    Compiler: C:/gnuarmemb/bin/arm-none-eabi-gcc.exe 
    Build flags: 
    Id flags:  
    
    The output was:
    1
    c:/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
    exit.c:(.text.exit+0x2c): undefined reference to `_exit'
    collect2.exe: error: ld returned 1 exit status


    Regards,
    Jonathan

Related