..\HAL_LIB\Inc\stm32l4xx_hal_rcc_ex.h(2424): error: #20: identifier "HAL_StatusTypeDef" is undefined

stm32工程编译时遇到这个错误,显示HAL_StatusTypeDef没有被定义,但是go  to definition又能找到定义

 后来在网上寻找解决办法,结果发现竟然是

#include "stm32l4xx_hal_spi.h"
#include "stm32l4xx_hal.h"

这两个的顺序问题,#include "stm32l4xx_hal.h"头文件包含必须在最前面,真是抽象

#include "stm32l4xx_hal.h"

#include "stm32l4xx_hal_spi.h"

 这样就没有错误了,完全不知道这是什么鬼要求!

posted @ 2024-05-11 16:32  Beatmyself99  阅读(501)  评论(0)    收藏  举报