Skip to main content
A.D.
Associate III
October 20, 2025
Question

C23 syntax highlighting in STM32CubeIDE (e.g. constexpr)

  • October 20, 2025
  • 3 replies
  • 214 views

The STM32 toolchain based on gcc 13.3 already supports a lot of C23 features, e.g. constexpr. This is really awesome.

But the current version of CubeIDE seems not to be able yet to parse these new features, so syntax checking / highlighting / code linking breaks.

Is there any simple workaround for this? Or is there information available, whether the next version of CubeIDE will update this?

3 replies

Andrew Neil
Super User
October 20, 2025

@A.D. wrote:

But the current version of CubeIDE seems not to be able yet to parse these new features, so syntax checking / highlighting / code linking breaks.


Indeed, the syntax highlighting in the editor is performed by CubeIDE (ie, Eclipse) - not the toolchain - so doesn't (yet) support C23:

See this recent thread: Defining enum type compiles ok, but STM32CubeIDE flags syntax error.

But that shouldn't affect linking.

Please give more details of the link issues you're seeing?

 


@A.D. wrote:

Is there any simple workaround for this? 


Does this help ?

 


@A.D. wrote:

Or is there information available, whether the next version of CubeIDE will update this?


As noted in that other thread, it's an Eclipse issue rather than specifically CubeIDE - so I guess Eclipse fora would be the place to find such info?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
A.D.
A.D.Author
Associate III
October 20, 2025

@Andrew Neil wrote:
But that shouldn't affect linking.
Please give more details of the link issues you're seeing?

Yes you are right, it was a wrong formulation used by me: Not actual code linking is breaking but the feature of the IDE to link a variable or constant to the place of definition by ctrl + mouse click.

The other thread you linked (no pun intended) describes exactly the same situation. As CubeIDE is based on Eclipse, I figured some ST member might already know if the next CubeIDE version will use a newer Eclipse build with C23 support in the language server.

mƎALLEm
Technical Moderator
April 14, 2026

Hello,

FYI,

Starting from CubeIDE 2.1.0 version, you could use C23 by following these steps:

1- right click on the project > Properties > C/C++ Build > Settings > MCU/MPU GCC Compiler > Miscellaneous > Add a new flag "-std=gnu23"

1.png

2- click on "C/C++ Build > Settings > MCU/MPU GCC Compiler > General > select "GCC Default" in the "language standard" combo list

2.png

3- Apply and close the Settings dialog

4- Clean and build the project

"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."
TDK
Super User
April 14, 2026

constexpr is in C+11.

STM32CubeIDE highlights it correctly by default, provided it's in a C++ source file.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
A.D.
A.D.Author
Associate III
April 15, 2026

@mƎALLEm Hey thanks for the heads up. We tried that, but the IDE is still flagging lines with constexpr as syntax error (without further explanation of that error):

AD_0-1776233968405.png

 

@TDK constexpr is also C23, and that until now is not supported by default. Since we don't use C++, the use of constexp is a little annoying in CubeIDE.

 

It's not that it is not compiling, that works without problems. It's simply the highlighting as a syntax error in the editor.