C++编译问题 undefined reference to `_exit'

发布于 2020-08-04 11:40:37    浏览:709

各位大神,小弟开启了C++功能,但是编译出了问题,编译打印如下,求助:

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -ffunction-sections -fdata-sections -Wall  -g -gdwarf-2 -Xlinker --gc-sections -Wl,-Map,"rtthread.map" -o "rtthread.elf"  ./rt-thread/src/clock.o ./rt-thread/src/components.o ./rt-thread/src/device.o ./rt-thread/src/idle.o ./rt-thread/src/ipc.o ./rt-thread/src/irq.o ./rt-thread/src/kservice.o ./rt-thread/src/memheap.o ./rt-thread/src/mempool.o ./rt-thread/src/object.o ./rt-thread/src/scheduler.o ./rt-thread/src/signal.o ./rt-thread/src/thread.o ./rt-thread/src/timer.o  ./rt-thread/libcpu/arm/cortex-m4/context_gcc.o ./rt-thread/libcpu/arm/cortex-m4/cpuport.o  ./rt-thread/libcpu/arm/common/backtrace.o ./rt-thread/libcpu/arm/common/div0.o ./rt-thread/libcpu/arm/common/showmem.o  ./rt-thread/components/libc/compilers/minilibc/ctype.o ./rt-thread/components/libc/compilers/minilibc/math.o ./rt-thread/components/libc/compilers/minilibc/qsort.o ./rt-thread/components/libc/compilers/minilibc/rand.o ./rt-thread/components/libc/compilers/minilibc/stdlib.o ./rt-thread/components/libc/compilers/minilibc/string.o ./rt-thread/components/libc/compilers/minilibc/time.o  ./rt-thread/components/finsh/cmd.o ./rt-thread/components/finsh/finsh_compiler.o ./rt-thread/components/finsh/finsh_error.o ./rt-thread/components/finsh/finsh_heap.o ./rt-thread/components/finsh/finsh_init.o ./rt-thread/components/finsh/finsh_node.o ./rt-thread/components/finsh/finsh_ops.o ./rt-thread/components/finsh/finsh_parser.o ./rt-thread/components/finsh/finsh_token.o ./rt-thread/components/finsh/finsh_var.o ./rt-thread/components/finsh/finsh_vm.o ./rt-thread/components/finsh/msh.o ./rt-thread/components/finsh/shell.o  ./rt-thread/components/drivers/src/completion.o ./rt-thread/components/drivers/src/dataqueue.o ./rt-thread/components/drivers/src/pipe.o ./rt-thread/components/drivers/src/ringblk_buf.o ./rt-thread/components/drivers/src/ringbuffer.o ./rt-thread/components/drivers/src/waitqueue.o ./rt-thread/components/drivers/src/workqueue.o  ./rt-thread/components/drivers/serial/serial.o  ./rt-thread/components/drivers/misc/pin.o  ./rt-thread/components/cplusplus/Mutex.o ./rt-thread/components/cplusplus/Semaphore.o ./rt-thread/components/cplusplus/Thread.o ./rt-thread/components/cplusplus/crt.o ./rt-thread/components/cplusplus/crt_init.o  ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cec.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_crc.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.o ./libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.o  ./libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f429xx.o  ./libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.o  ./libraries/HAL_Drivers/drv_common.o ./libraries/HAL_Drivers/drv_gpio.o ./libraries/HAL_Drivers/drv_usart.o  ./board/CubeMX_Config/Src/stm32f4xx_hal_msp.o  ./board/board.o  ./applications/main.o   
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/fpu\libg.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x16): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:75: rtthread.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.

请问exit.c:(.text.exit+0x16): undefined reference to `_exit'问题应该如何解决

查看更多

2 个回答
keyq
keyq 2020-12-04
This guy hasn't written anything yet

我也遇到了怎么解决呢?

wuhanstudio
wuhanstudio 2021-04-04
This guy hasn't written anything yet

打开 libc 就可以了:

RT-Thread Components  --->
  POSIX layer and C standard library  --->
    [*] Enable libc APIs from toolchain

撰写答案

请登录后再发布答案,点击登录
关注者
0
被浏览
709

发布
问题

分享
好友

手机
浏览

扫码手机浏览