keil5 编译头文件总是出现错误,请问大家这个有什么问题吗?我感觉没问题啊
#define APB1_base 0x40000000
#define APB2_base 0x40010000
#define AHB_base 0x40018400
#define GPIOA_base (unsigned int *)APB2_base + 0x800
#define GPIOB_base ((unsigned int )APB2_base + 0xC00)
#define GPIOC_base ((unsigned int *)GPIOB_base + 0x400)
#define GPIOD_base (unsigned int *)GPIOC_base + 0x400
#define GPIOE_base (unsigned int *)GPIOD_base + 0x400
#define GPIOF_base (unsigned int *)GPIOE_base + 0x400
#define GPIOG_base (unsigned int *)GPIOF_base + 0x400
typedef (unsigned int) uint_32;
typedef struct
{
uint_32 CRL;
uint_32 CRH;
uint_32 IDR;
uint_32 ODR;
uint_32 BSRR;
uint_32 BSR;
uint_32 LCKR;
} GPIO_TYPR;
#define GPIO_B ((GPIO_TYPR *) GPIOB_base)
#define RCC_base (unsigned int )0x40021000
#define RCC_ENR (*(unsigned int *)RCC_base + 0x18)
#include"stm32F103.h"
void SystemInit(void);
int main(void)
{
GPIO_B->CRL &= ~(0x1111);
GPIO_B->CRL |= (1);
GPIO_B->BSRR |= (1<<16);
RCC_ENR |= (1<<3);
return 0;
}
void SystemInit(void)
{
}
这是错误描述
[](
```c
compiling main.c...
stm32F103.h(15): error: #40: expected an identifier
typedef (unsigned int) uint_32;
stm32F103.h(15): error: #65: expected a ";"
typedef (unsigned int) uint_32;
stm32F103.h(20): error: #20: identifier "uint_32" is undefined
uint_32 CRL;
stm32F103.h(21): error: #20: identifier "uint_32" is undefined
uint_32 CRH;
stm32F103.h(22): error: #20: identifier "uint_32" is undefined
uint_32 IDR;
stm32F103.h(23): error: #20: identifier "uint_32" is undefined
uint_32 ODR;
stm32F103.h(24): error: #20: identifier "uint_32" is undefined
uint_32 BSRR;
stm32F103.h(25): error: #20: identifier "uint_32" is undefined
uint_32 BSR;
stm32F103.h(26): error: #20: identifier "uint_32" is undefined
uint_32 LCKR;
main.c(12): error: #137: expression must be a modifiable lvalue
RCC_ENR |= (1<<3);
main.c: 0 warnings, 10 errors
"main.c" - 10 Error(s), 0 Warning(s).
```)