
錯誤資訊如下
compiling main.c...
main.c(5): error: #20: identifier "GPIO_InitTypeDef" is undefined
GPIO_InitTypeDef GPIO_InitStructure;
main.c(6): warning: #223-D: function "RCC_APB2PeriphClockCmd" declared implicitly
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOE,ENABLE);//??PE,pe????
main.c(6): error: #20: identifier "RCC_APB2Periph_GPIOB" is undefined
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOE,ENABLE);//??PE,pe????
main.c(6): error: #20: identifier "RCC_APB2Periph_GPIOE" is undefined
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOE,ENABLE);//??PE,pe????
main.c(8): error: #20: identifier "GPIO_Pin_5" is undefined
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_5; // LED0-->PB.5????
main.c(9): error: #20: identifier "GPIO_Mode_Out_PP" is undefined
GPIO_InitStructure.GPIO_Mode =GPIO_Mode_Out_PP;//????
main.c(10): error: #20: identifier "GPIO_Speed_50MHz" is undefined
GPIO_InitStructure.GPIO_Speed =GPIO_Speed_50MHz; //IO????50MHz
main.c(11): warning: #223-D: function "GPTIO_Init" declared implicitly
GPTIO_Init(GPTIOB,&GPIO_InitStructure); //?????????GPIO.5
main.c(11): error: #20: identifier "GPTIOB" is undefined
GPTIO_Init(GPTIOB,&GPIO_InitStructure); //?????????GPIO.5
main.c(12): warning: #223-D: function "GPIO_SetBits" declared implicitly
GPIO_SetBits(GPIOB,GPIO_Pin_5);//PB.5???
main.c(14): error: #20: identifier "GPTIO_InitStructure" is undefined
GPTIO_InitStructure.GPIO_Pin =GPIO_Pin_5; // LED0-->PB.5???? ????
main.c(15): error: #20: identifier "GPTIOE" is undefined
GPTIO_Init(GPTIOE,&GPIO_InitStructure); //???? ,IO????50MHz
main.c(19): warning: #223-D: function "GPIO_ResetBits" declared implicitly
GPIO_ResetBits(GPIOB,GPIO_Pin_5);
main.c(21): warning: #223-D: function "Delay" declared implicitly
Delay(3000000);
main.c: 5 warnings, 9 errors
"..\OBJ\Template.axf" - 9 Error(s), 5 Warning(s).
Target not created.
Build Time Elapsed: 00:00:01
uj5u.com熱心網友回復:
#include "stm32f10x_gpio.h"少這個頭檔案
uj5u.com熱心網友回復:
樓上正解,打開 stm32f10x.h 看看 #include "stm32f10x_gpio.h" 是不是被屏蔽了,沒有的話,看看工程是否有 stm32f10x_gpio.cuj5u.com熱心網友回復:
添加工程標準庫,可以是全部目錄拷貝再添加進來,然后找到組態檔,把所有庫檔案或需要的取消注釋包含進來 ,在工程中添加編譯頭檔案路徑到最下一層,就好了,用HAL庫去的盡量使用cubeMX配置,方便,可以快速進階uj5u.com熱心網友回復:
我覺得可能不止缺少頭檔案,你使用的是庫函式配置方法,必須要有標準庫才能用,你可以先寫一個GPIO_Init();然后跳轉一下,看看有沒有標準庫函式,如果有,在添加相應的頭檔案就好了。轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/22168.html
標籤:單片機/工控
