Skip to main content
FMarr.2
Associate III
June 25, 2021
Question

Using std::mutex with STM32H7B3I

I got an error when try to use std::mutex, std::lock and similar.

There is a define _GLIBCXX_HAS_GTHREADS that prevents compiling of .

Is there a way to define it from compilation or an implementation of std::mutex in RTOS?

Best Regards

This topic has been closed for replies.

3 replies

Amel NASRI
ST Technical Moderator
June 29, 2021

Hi @Community member​ ,

To allow the community to help you, you need to provide some more details:

  • are you using an example available in STM32CubeH7 package? If yes, which package version?
  • or may be you generate the code with STM32CubeMX? Please share the .ioc file in this case.
  • which IDE?

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
FMarr.2
FMarr.2Author
Associate III
June 29, 2021

This is the full project:

STM32CubeIde 1.5

All necessary files are included.

Thank you very much

FMarr.2
FMarr.2Author
Associate III
June 30, 2021

Hello Amel NASRI,

thanks for your interesting in the problem.

I think my problem is:

I would like to use some funtionality, for example std::mutex. From standard namespace.

A mutex depends on the O.S. Can be implemented by mean of a semaphore for example.

For RTOS, it seems this implementation is not available or at least is protected by a define not defined.

Is it possible somehow to enable the implementation?

Someone did this job, https://embeddedartistry.com/blog/2018/02/01/implementing-stdmutex-with-threadx/

but for me is not clear how to fit in STM32CubeIde.

Best Regards