When I'm programming on my STM32 project, VSCode constantly underlines the code #include "main.h" with the reason belows:
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit. cannot open source file "stm32f1xx.h" (dependency of "main.h")
However, I double-checked my c_cpp_properties.json, finding nothing wrong with it. Meanwhile, VSCode has given me the quick fix method, adding ${workspaceFolder}/Drivers/CMSIS/Device/ST/STM32F1xx/Include to includePath parameter, which didn't work either.
Belows are my configurations.
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"USE_HAL_DRIVER",
"STM32F103xE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"compilerPath": "C:\\Program Files (x86)\\GNU Arm Embedded Toolchain\\10 2021.07\\bin\\arm-none-eabi-gcc.exe",
"intelliSenseMode": "gcc-arm"
},
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"USE_HAL_DRIVER",
"STM32F103xE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"compilerPath": "/opt/ARM/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gcc",
"intelliSenseMode": "gcc-arm"
}
],
"version": 4
}
And the required file /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h does exist and the compilation with make can be done correctly too.
I've check the files multiple times but didn't find any problem, like belows:
/Drivers/...looks like Linux, Is that the full path/Drivers/...means theDriversfolder under the folder of the project, e.g.STM32Project/Drivers/...main.h?