Arduino example fails to build, stm32_def.h: No such file or directory

Apologies for reviving this topic, but I faced the same issue.
My ArduinoCore-mbed framework’s version is 4.2.4
I resolved it by following this post.
The includes.txt file on windows should be at C:\Users\<username>\.platformio\packages\framework-arduino-mbed\variants\PORTENTA_H7_M7

This is my platformio.ini file

[env:portenta_h7_m7]
platform = ststm32
board = portenta_h7_m7
framework = arduino
lib_deps = 
   khoih-prog/AsyncMQTT_Generic@^1.8.1
   

lib_ignore =
   STM32Ethernet
   STM32duino LwIP
   STM32AsyncTCP