OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 5016|回复: 2

你好,新手询问。使用开发板芯片是STM32F407,我是看视频,跟着讲课老师一起编写的程序,结果视频中老师的编译通过,而我的却报错

[复制链接]

3

主题

21

帖子

0

精华

初级会员

Rank: 2

积分
119
金钱
119
注册时间
2021-4-11
在线时间
7 小时
发表于 2021-4-12 09:39:40 | 显示全部楼层 |阅读模式
1金钱
main.c(8): error:  #169: expected a declaration
  {
main.c(29): error:  #77-D: this declaration has no storage class or type specifier
          USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
main.c(29): error:  #65: expected a ";"
          USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
main.c(30): error:  #77-D: this declaration has no storage class or type specifier
          USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
main.c(30): error:  #65: expected a ";"
          USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
main.c(31): error:  #77-D: this declaration has no storage class or type specifier
          USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
main.c(31): error:  #65: expected a ";"
          USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
main.c(32): error:  #77-D: this declaration has no storage class or type specifier
          USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;        //收发模式
main.c(32): error:  #65: expected a ";"
          USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;        //收发模式
main.c(33): error:  #79: expected a type specifier
    USART_Init(USART1, &USART_InitStructure); //初始化串口1
main.c(33): error:  #79: expected a type specifier
    USART_Init(USART1, &USART_InitStructure); //初始化串口1
main.c(33): warning:  #77-D: this declaration has no storage class or type specifier
    USART_Init(USART1, &USART_InitStructure); //初始化串口1
main.c(33): error:  #147: declaration is incompatible with "void USART_Init(USART_TypeDef *, USART_InitTypeDef *)"  (declared at line 372 of "..\FWLIB\inc\stm32f4xx_usart.h")
    USART_Init(USART1, &USART_InitStructure); //初始化串口1
main.c(35): error:  #79: expected a type specifier
          USART_Cmd(USART1, ENABLE);  //使能串口1
main.c(35): error:  #757: constant "ENABLE"  is not a type name
          USART_Cmd(USART1, ENABLE);  //使能串口1
main.c(35): warning:  #77-D: this declaration has no storage class or type specifier
          USART_Cmd(USART1, ENABLE);  //使能串口1
main.c(35): error:  #147: declaration is incompatible with "void USART_Cmd(USART_TypeDef *, FunctionalState)"  (declared at line 376 of "..\FWLIB\inc\stm32f4xx_usart.h")
          USART_Cmd(USART1, ENABLE);  //使能串口1
main.c(37): error:  #79: expected a type specifier
          USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
main.c(37): error:  #79: expected a type specifier
          USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
main.c(37): error:  #757: constant "ENABLE"  is not a type name
          USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
main.c(37): warning:  #77-D: this declaration has no storage class or type specifier
          USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
main.c(37): error:  #147: declaration is incompatible with "void USART_ITConfig(USART_TypeDef *, uint16_t, FunctionalState)"  (declared at line 411 of "..\FWLIB\inc\stm32f4xx_usart.h")
          USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
main.c(39): error:  #77-D: this declaration has no storage class or type specifier
          NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
main.c(39): error:  #65: expected a ";"
          NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
main.c(40): error:  #77-D: this declaration has no storage class or type specifier
          NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1;
main.c(40): error:  #65: expected a ";"
          NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1;
main.c(41): error:  #77-D: this declaration has no storage class or type specifier
          NVIC_InitStructure.NVIC_IRQChannelSubPriority=1;
main.c(41): error:  #65: expected a ";"
          NVIC_InitStructure.NVIC_IRQChannelSubPriority=1;
main.c(42): error:  #77-D: this declaration has no storage class or type specifier
          NVIC_InitStructure.NVIC_IRQChannel=USART1_IRQn;
main.c(42): error:  #65: expected a ";"
          NVIC_InitStructure.NVIC_IRQChannel=USART1_IRQn;
main.c(43): error:  #79: expected a type specifier
          NVIC_Init( &NVIC_InitStructure);
main.c(43): warning:  #77-D: this declaration has no storage class or type specifier
          NVIC_Init( &NVIC_InitStructure);
main.c(43): error:  #147: declaration is incompatible with "void NVIC_Init(NVIC_InitTypeDef *)"  (declared at line 159 of "..\FWLIB\inc\misc.h")
          NVIC_Init( &NVIC_InitStructure);
main.c(45): error:  #169: expected a declaration
  }
main.c: 4 warnings, 30 errors
compiling stm32f4xx_wwdg.c...
compiling stm32f4xx_it.c...
compiling delay.c...
compiling system_stm32f4xx.c...
compiling sys.c...
compiling usart.c...
"..\OBJ\Template.axf" - 30 Error(s), 5 Warning(s).
Target not created.
Build Time Elapsed:  00:00:04

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

12

主题

3344

帖子

1

精华

论坛元老

Rank: 8Rank: 8

积分
8465
金钱
8465
注册时间
2020-5-11
在线时间
3904 小时
发表于 2021-4-12 10:50:30 | 显示全部楼层
能不能别用背景色,看不清。
没看到你的程序或者工程,让人猜吗?
专治疑难杂症
回复

使用道具 举报

6

主题

890

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1477
金钱
1477
注册时间
2020-8-19
在线时间
335 小时
发表于 2021-4-12 11:29:03 | 显示全部楼层
stm32f10x_usart.c和misc.c看看有没有添加
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-2-28 03:50

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表