C++ C++;2个基于Eclipse的IDE,1个捕获异常,另一个不捕获';T

C++ C++;2个基于Eclipse的IDE,1个捕获异常,另一个不捕获';T,c++,eclipse,C++,Eclipse,我现在有点困了。 我最近一直在做C++项目,但是我遇到了异常。 目标是STM32。 我使用STs Cube MX代码生成器设置了2个项目。 执行的代码是 try { throw 1; } catch(const int& ex) { configASSERT(0); } 我使用的IDE(SW4STM32,基于eclipse,g++)无法捕获异常。我总是遇到终止处理程序。另一个IDE(AtolicTrueStudio

我现在有点困了。 我最近一直在做C++项目,但是我遇到了异常。 目标是STM32。 我使用STs Cube MX代码生成器设置了2个项目。 执行的代码是

try
    {
        throw 1;
    }
    catch(const int& ex)
    {
        configASSERT(0);
    }
我使用的IDE(SW4STM32,基于eclipse,g++)无法捕获异常。我总是遇到终止处理程序。另一个IDE(AtolicTrueStudio,基于eclipse的,g++)捕获异常

因此,这不是一个目标问题,而是一个IDE问题。我已经从g++编译器和链接器选项中删除了fno异常。但还是没有运气。 关于去哪里找,你还有其他想法吗

Thx:)

编辑: SW4STM32编译器标志(控制台输出)

SW4STM32连接器输出

Building target: Test_Exceptions_AC6.elf
Invoking: MCU G++ Linker
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -specs=nosys.specs -specs=nano.specs -T"../STM32F429ZITx_FLASH.ld" -Wl,-Map=output.map -Wl,--gc-sections -fno-rtti -o "Test_Exceptions_AC6.elf" @"objects.list"   -lm
Finished building target: Test_Exceptions_AC6.elf

make --no-print-directory post-build
Generating hex and Printing size information:
arm-none-eabi-objcopy -O ihex "Test_Exceptions_AC6.elf" "Test_Exceptions_AC6.hex"
arm-none-eabi-size "Test_Exceptions_AC6.elf"
   text    data     bss     dec     hex filename
阿耳输出

   22:46:09 **** Incremental Build of configuration Debug for project Exceptions_True_Studio ****
Info: Internal Builder is used for build
arm-atollic-eabi-g++ -c ..\Core\Src\User\Test\Test.cpp -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c++14 -DSTM32F10X_MD -DSTM32F429xx -D__packed=__attribute__((__packed__)) -D__weak=__attribute__((weak)) -DUSE_STDPERIPH_DRIVER -I../Core/Inc/User -I../Core/Inc/ -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -O0 -ffunction-sections -g -fstack-usage -Wall -Wextra -Wfatal-errors -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -fno-threadsafe-statics -o Core\Src\User\Test\Test.o 
..\Core\Src\User\Test\Test.cpp: In function 'void Test_Func()':
..\Core\Src\User\Test\Test.cpp:47:21: warning: unused variable 'n_elements' [-Wunused-variable]
   volatile uint32_t n_elements = test_custom_list.size();
                     ^~~~~~~~~~
arm-atollic-eabi-g++ -o Exceptions_True_Studio.elf Core\Src\User\Test\Test.o Core\Src\crc.o Core\Src\dma2d.o Core\Src\fmc.o Core\Src\freertos.o Core\Src\gpio.o Core\Src\i2c.o Core\Src\ltdc.o Core\Src\main.o Core\Src\spi.o Core\Src\stm32f4xx_hal_msp.o Core\Src\stm32f4xx_hal_timebase_TIM.o Core\Src\stm32f4xx_it.o Core\Src\system_stm32f4xx.o Core\Src\tim.o Core\Src\usart.o Core\Src\usb_otg.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma2d.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dsi.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_hcd.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_ltdc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_ltdc_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_sdram.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_fmc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_usb.o Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.o Middlewares\Third_Party\FreeRTOS\Source\croutine.o Middlewares\Third_Party\FreeRTOS\Source\event_groups.o Middlewares\Third_Party\FreeRTOS\Source\list.o Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.o Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.o Middlewares\Third_Party\FreeRTOS\Source\queue.o Middlewares\Third_Party\FreeRTOS\Source\tasks.o Middlewares\Third_Party\FreeRTOS\Source\timers.o startup\startup_stm32f429xx.o -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -T../STM32F429ZI_FLASH.ld -specs=nosys.specs -static -Wl,-cref,-u,Reset_Handler, -Wl,-Map=Exceptions_True_Studio.map -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x1000 -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group 
C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.0.1\ide\jre\bin\java -jar C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.0.1\Tools\arm-atollic-reports.jar sizeinfo list Exceptions_True_Studio.elf 
Generate build reports...
Print size information
   text    data     bss     dec     hex filename
 307304    1924  173124  482352   75c30 Exceptions_True_Studio.elf
Print size information done
Generate listing file
Output sent to: Exceptions_True_Studio.list
Generate listing file done
Generate build reports done
arm-atollic-eabi-objcopy.exe -O ihex Exceptions_True_Studio.elf Exceptions_True_Studio.hex 
Info: Parallel threads used: 1

22:46:21 Build Finished (took 12s.140ms)
现在,正如您所看到的,没有FNOException处于活动状态。因此,我希望收到例外情况:(

SW4STM32使用Eclipse平台4.6.3 Eclipse CDT 9.2.1 Attolic使用Eclipse平台4.6.1、Eclipse CDT 9.1.0

所以eclipse的基本版本非常相似。
你有其他的想法吗?< /P>这是一个有很多可能性的大帐篷。我建议把Eclipse版本、CDT版本、GDB版本和GCC版本添加到这个问题中。我不认为这是IDE问题。检查编译器标志。C++异常是非常昂贵的,而且在嵌入式开发中不经常使用。编辑我的第一篇帖子。请看一看:)
   22:46:09 **** Incremental Build of configuration Debug for project Exceptions_True_Studio ****
Info: Internal Builder is used for build
arm-atollic-eabi-g++ -c ..\Core\Src\User\Test\Test.cpp -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c++14 -DSTM32F10X_MD -DSTM32F429xx -D__packed=__attribute__((__packed__)) -D__weak=__attribute__((weak)) -DUSE_STDPERIPH_DRIVER -I../Core/Inc/User -I../Core/Inc/ -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -O0 -ffunction-sections -g -fstack-usage -Wall -Wextra -Wfatal-errors -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -fno-threadsafe-statics -o Core\Src\User\Test\Test.o 
..\Core\Src\User\Test\Test.cpp: In function 'void Test_Func()':
..\Core\Src\User\Test\Test.cpp:47:21: warning: unused variable 'n_elements' [-Wunused-variable]
   volatile uint32_t n_elements = test_custom_list.size();
                     ^~~~~~~~~~
arm-atollic-eabi-g++ -o Exceptions_True_Studio.elf Core\Src\User\Test\Test.o Core\Src\crc.o Core\Src\dma2d.o Core\Src\fmc.o Core\Src\freertos.o Core\Src\gpio.o Core\Src\i2c.o Core\Src\ltdc.o Core\Src\main.o Core\Src\spi.o Core\Src\stm32f4xx_hal_msp.o Core\Src\stm32f4xx_hal_timebase_TIM.o Core\Src\stm32f4xx_it.o Core\Src\system_stm32f4xx.o Core\Src\tim.o Core\Src\usart.o Core\Src\usb_otg.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma2d.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dsi.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_hcd.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_i2c_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_ltdc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_ltdc_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_sdram.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_fmc.o Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_usb.o Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.o Middlewares\Third_Party\FreeRTOS\Source\croutine.o Middlewares\Third_Party\FreeRTOS\Source\event_groups.o Middlewares\Third_Party\FreeRTOS\Source\list.o Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.o Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.o Middlewares\Third_Party\FreeRTOS\Source\queue.o Middlewares\Third_Party\FreeRTOS\Source\tasks.o Middlewares\Third_Party\FreeRTOS\Source\timers.o startup\startup_stm32f429xx.o -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -T../STM32F429ZI_FLASH.ld -specs=nosys.specs -static -Wl,-cref,-u,Reset_Handler, -Wl,-Map=Exceptions_True_Studio.map -Wl,--gc-sections -Wl,--defsym=malloc_getpagesize_P=0x1000 -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group 
C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.0.1\ide\jre\bin\java -jar C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.0.1\Tools\arm-atollic-reports.jar sizeinfo list Exceptions_True_Studio.elf 
Generate build reports...
Print size information
   text    data     bss     dec     hex filename
 307304    1924  173124  482352   75c30 Exceptions_True_Studio.elf
Print size information done
Generate listing file
Output sent to: Exceptions_True_Studio.list
Generate listing file done
Generate build reports done
arm-atollic-eabi-objcopy.exe -O ihex Exceptions_True_Studio.elf Exceptions_True_Studio.hex 
Info: Parallel threads used: 1

22:46:21 Build Finished (took 12s.140ms)