m0_74203003 2023-04-11 10:37 采纳率: 85.7%
浏览 36
已结题

keil5 编译头文件总是出现错误,请问大家这个有什么问题吗?

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).

```)

  • 写回答

2条回答 默认 最新

  • qllaoda 2023-04-11 10:58
    关注

    错误提示贴出来啊,

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月19日
  • 已采纳回答 4月11日
  • 修改了问题 4月11日
  • 创建了问题 4月11日

悬赏问题

  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”