Question about "include" error

Hello everyone. I have a project now, but this project always has the error :“cannot open source file “xxx.h””. I will not configure platformio.ini. Can I help this project compile normally?

Will not, or have not?

Leaving the project as it is, having the following in your platformio.ini gets it nearly there (it now starts compiling, but something is still wrong - either I’ve misconfigured it, or the code isn’t right)…

src_dir = Src

platform = ststm32
board = disco_f429zi
framework = stm32cube
build_flags = 
  -I Inc 
  -I Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS 
  -I Middlewares/Third_Party/FreeRTOS/Source/include 
  -I Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F

If you don’t want to configure your platformio.ini… you need to rename Src to src (lower case S), rename Inc to include, and I’m not sure the best way to deal with the Middleware folder, as you need the FreeRTOS bits in there in the include path.

The rest is up to someone who’s more familiar with this stuff to work out!

Thank you for your answer.:smiley:

1 Like

I still have a question. Why do you use “build_dir” instead of “include_dir”?

1 Like

Look again… build_flags, not build_dir :wink:

As far as the build_flags parameter is concerned for platformio, build_flag is the parameter that passes stuff to the preprocessing, compilation, assembly and linking processes.

all right.:rofl: Thank you for your answer

1 Like