Search code examples
c++visual-studio-codestm32keilstm32-hal

VSCode marks GPIO_TypeDef in HAL library as unknown


I have some functions that refer to GPIO_TypeDef struct from STM32_HAL library and in Keil I recieve no errors in compilation, but VSCode marks it as "unknown identificator" error. I fixed it with adding

#include "stm32f103xe.h"

to main.hand both Keil and VScode now take it with no problems, but maybe I had to change something in VSCode settings to fix that problem.


Solution

  • I found answer in CubeIDE directives. Add theese to C_Cpp.default.defines (You can simply do this through Settings->Extensions->C/C++->Defines)

    __CC_ARM
    STM32F1xx
    USE_HAL_DRIVER
    DEBUG