How to fix PlatformIO mbed error: 'Mutex' does not name a type
Problem:
You are trying to compile your PlatformIO mbed application using Mutexes like
mutex-example.c
Mutex myLock;but you see an error message like
mutex-error.txt
src\main.cpp:3:1: error: 'Mutex' does not name a type
Mutex myLock;
^~~~~Solution
Add this line to your platformio.ini:
platformio.ini.snippet
build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENTThis will enable the RTOS features in mbed, including the Mutex.
Check out similar posts by category:
Mbed, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow