cancel
Showing results for 
Search instead for 
Did you mean: 

How to use C++17 standard in STM32CubeIDE

Vergnani_ElEn
Associate

Hi, 

I'm working on a new Firmware Framework, but I need to use C++17 standard. I used STM32CubeMx tools for generating code and now I'm compiling with C++14.

How I can change standard? Instead to compile with C++14 I want to compile using C++17.

9 REPLIES 9
ferro
Lead

looks like a solution. But I just tried with a new installation of CubeIDE 1.18.1 with a project for nucleo G0B1RE and there is no entry for "MCU G++ Compiler", only "MCU GCC Compiler".

Then I restarted the IDE, created one more project for a nucleo F401RE. Here I can find your settings "MCU G++ Compiler". The G++ settings in the G0B1RE project are still not to find.

Thanks !!

I'm moving the first steps on STM32. They are great microcontroller!

Hello @Vergnani_ElEn and welcome to the community, if @ferro answered your question please accept his reply as solution.

Thank you

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hm, interesting. Could it be that toolchain support for C++ is missing for that MCU ?

It is Cortex M0+. I expect it is more about the Project template than C++ support.

https://www.st.com/en/evaluation-tools/nucleo-g0b1re.html#st_all-features_sec-nav-tab

 

https://www.st.com/resource/en/data_brief/nucleo-g0b1re.pdf

 

ferro_0-1749118369246.png

 

https://www.st.com/en/microcontrollers-microprocessors/stm32g070rb.html?ecmp=tt9470_gl_link_feb2019&rt=db&id=DB2196

"They are great microcontroller!"

Absolutely. And dev tools as well, TouchGfx. If I may suggest, use C++20.

I asked my g++ compiler, what MCUs it supports and below is the list of Cortex M. Your board is cortex-m0plus so the compiler's backend is there. I dont know what is the proper command to generate the list but error message gives what I wanted.

>> arm-none-eabi-g++ -mcpu=h

cortex-m1
cortex-m0
cortex-m0plus
cortex-m1.small-multiply
cortex-m1.small-multiply
cortex-m0.small-multiply
cortex-m0.small-multiply
cortex-m0plus.small-multiply
cortex-m0plus.small-multiply
cortex-m7
cortex-m4
cortex-m3
exynos-m1
cortex-m23
cortex-m33
cortex-m35p
cortex-m55


You can find compiler here
c:\ST\STM32CubeIDE_1.17.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.1.0.202410251130\tools\bin\

 

mfgkw
Associate II

One more test with STM32C031 (also M0+): the settings for C++ are there!

So M0+ seems not be the problem in general.

@Vergnani_ElEn: which MCU did you try?

 

 

PS: One more test with Nucleo-G0B1RE: now I have the C++ settings here as well.

Maybe there was something missing after new installation of CubeIDE? Really strange behaviour...

Pavel A.
Super User

Convert your Eclipse C project to C++ and settings for C++ compiler will appear.