Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Addeding -fxceptions flag to G++ Compiler
Addeding -fxceptions flag to G++ Compiler [message #1784257] Sun, 25 March 2018 09:08 Go to next message
Julius Caesar is currently offline Julius CaesarFriend
Messages: 7
Registered: March 2018
Junior Member
Hey guys,
was hoping you could tell me how to add complier flags to eclipse.
I have created a c++ project however i need to use exceptions. By default they are disabled.

Building file: ../Src/User/SD/XML/pugixml.cpp
Invoking: MCU G++ Compiler
\Debug
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F429xx -I"/Inc" -I"/Inc/User" -I"Inc/User/SD/XML" -I"/Inc/User/display" -I"/Inc/User/SD" -I"/Drivers/STM32F4xx_HAL_Driver/Inc" -I"/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy" -I"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F" -I"/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" -I"/Middlewares/ST/STemWin/Config" -I"/Middlewares/ST/STemWin/inc" -I"/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Inc" -I"/Drivers/CMSIS/Device/ST/STM32F4xx/Include" -I"/Middlewares/Third_Party/FatFs/src" -I"Middlewares/Third_Party/FreeRTOS/Source/include" -I"/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS" -I"/Drivers/CMSIS/Include"  -O2 -g3 -Wall -Wconversion -fmessage-length=0 -fexceptions -ffunction-sections -c -fno-exceptions -fno-rtti -MMD -MP -MF"Src/User/SD/XML/pugixml.d" -MT"Src/User/SD/XML/pugixml.o" -o "Src/User/SD/XML/pugixml.o" "../Src/User/SD/XML/pugixml.cpp"
../Src/User/SD/XML/pugixml.cpp: In member function 'void* pugi::impl::{anonymous}::xpath_allocator::allocate(size_t)':
../Src/User/SD/XML/pugixml.cpp:7451:26: error: exception handling disabled, use -fexceptions to enable
     throw std::bad_alloc();



So i tried to add -fexceptions to the miscellaneous options of the G++ Compiler. But this did not work. Same error message. Could you tell me what i did wrong?

greets
  • Attachment: Eclipse.PNG
    (Size: 89.66KB, Downloaded 260 times)
Re: Addeding -fxceptions flag to G++ Compiler [message #1784327 is a reply to message #1784257] Mon, 26 March 2018 21:15 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Likely caused by -fexceptions followed by -fno-exceptions.

arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F429xx -I"/Inc" -I"/Inc/User" -I"Inc/User/SD/XML" -I"/Inc/User/display" -I"/Inc/User/SD" -I"/Drivers/STM32F4xx_HAL_Driver/Inc" -I"/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy" -I"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F" -I"/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" -I"/Middlewares/ST/STemWin/Config" -I"/Middlewares/ST/STemWin/inc" -I"/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Inc" -I"/Drivers/CMSIS/Device/ST/STM32F4xx/Include" -I"/Middlewares/Third_Party/FatFs/src" -I"Middlewares/Third_Party/FreeRTOS/Source/include" -I"/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS" -I"/Drivers/CMSIS/Include" -O2 -g3 -Wall -Wconversion -fmessage-length=0 -fexceptions -ffunction-sections -c -fno-exceptions -fno-rtti -MMD -MP -MF"Src/User/SD/XML/pugixml.d" -MT"Src/User/SD/XML/pugixml.o" -o "Src/User/SD/XML/pugixml.o" "../Src/User/SD/XML/pugixml.cpp"


You'll have to find out where the -fno-exceptions is coming from and disable it.
Alternately, you could try modifying the Expert Settings: command line pattern:
and insert -fexceptions between ${FLAGS} and ${OUTPUT_FLAG}

[Updated on: Tue, 27 March 2018 03:04]

Report message to a moderator

Re: Addeding -fxceptions flag to G++ Compiler [message #1784499 is a reply to message #1784327] Wed, 28 March 2018 17:40 Go to previous message
Julius Caesar is currently offline Julius CaesarFriend
Messages: 7
Registered: March 2018
Junior Member
thx for the tip !
The -fno-exceptions came from the Miscellaneous tab in the G++ settings!
There is a checkbox which sets the fnoexceptions flag :)
Previous Topic:Running Google Test in MacOS
Next Topic:Integrated Java/C/C+ IDE
Goto Forum:
  


Current Time: Fri Apr 26 18:27:00 GMT 2024

Powered by FUDForum. Page generated in 0.02825 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top