中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. "); //-->

        博客專欄

        EEPW首頁 > 博客 > STM32 HAL庫 error: #20: identifier "HAL_StatusTypeDef" is undefined問題

        STM32 HAL庫 error: #20: identifier "HAL_StatusTypeDef" is undefined問題

        發(fā)布人:電子禪石 時間:2025-04-02 來源:工程師 發(fā)布文章

        error: #20: identifier “HAL_StatusTypeDef” is undefined

        我使用的是stm32l0的芯片,由于沒有標準庫可用,無奈只有折騰HAL庫了。


        首先,說下上面的錯誤怎么來的。我使用stm32cubeMX自動生成了代碼,

        并且自己在工程里面新建了文件,文件里面需要用到HAL外設(shè)庫中定義的宏定義,

        本來應(yīng)該添加包含“stm32l0xx_hal_dac.h”,但是我發(fā)現(xiàn)”stm32l0xx_hal_conf.h” 

        中有所有外設(shè)的頭文件,并且通過宏定義打開,所以我在該文件中添加了下面的語句:


        #include "stm32l0xx_hal_conf.h" 

        1

        編譯后就出現(xiàn)了如下錯誤:

        ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h(374): error: #20: identifier

        “HAL_StatusTypeDef” is undefined

        HAL_StatusTypeDef HAL_Init(void);

        ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h(375): error: #20: identifier

        “HAL_StatusTypeDef” is undefined

        HAL_StatusTypeDef HAL_DeInit(void);

        ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h(378): error: #20: identifier

        “HAL_StatusTypeDef” is undefined

        HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority);

        ..\Drv\dac\drv_dac.c: 0 warnings, 3 errors


        一直想不明白,“HAL_StatusTypeDef”變量在“stm32l0xx_hal_def.h”中已經(jīng)有了定義,

        并且該變量也能成功跳轉(zhuǎn)被找到。我已經(jīng)包含了宏定義文件“stm32l0xx_hal_conf.h”,

        宏定義”HAL_DAC_MODULE_ENABLED“也使能了,添加的文件中變量也能成功跳轉(zhuǎn)找到

        “stm32l0xx_hal_dac.h”中的定義,為什么會報錯!


        后來,我在整理main.c文件發(fā)現(xiàn),其添加的頭文件是“stm32l0xx_hal.h”,而不是文件

        “stm32l0xx_hal_conf.h”,于是,我將自己添加文件中改為


        #include "stm32l0xx_hal.h" 

        1

        再次編譯工程,居然編譯成功了。其中的原因,我還沒有想明白,想明白了再回來補上。

        如果有大神知道原因,請指教!



        ————————————————


                                

        原文鏈接:https://blog.csdn.net/lijing198997/article/details/76455550


        *博客內(nèi)容為網(wǎng)友個人發(fā)布,僅代表博主個人觀點,如有侵權(quán)請聯(lián)系工作人員刪除。



        關(guān)鍵詞: stm32

        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉