我是靠谱客的博主 腼腆雪糕,最近开发中收集的这篇文章主要介绍中文字符在Keil中导致的错误问题(错误代码:#7 #12-D #20 #223-D #247),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

在写完串口chen程序bian编译时发现报错  27 Error(s), 13 Warning(s),主要错误还在main.c中,通过百度发现主要是 #7错误,错误提示如下:

 

*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'C:Keil_v5ARMARMCCBin'
Rebuild target 'Demo'
assembling startup_stm32f10x_hd.s...
compiling core_cm3.c...
compiling misc.c...
compiling stm32f10x_bkp.c...
compiling system_stm32f10x.c...
compiling stm32f10x_cec.c...
compiling stm32f10x_adc.c...
compiling stm32f10x_can.c...
compiling stm32f10x_crc.c...
compiling stm32f10x_dma.c...
compiling stm32f10x_dbgmcu.c...
compiling stm32f10x_dac.c...
compiling stm32f10x_flash.c...
compiling stm32f10x_exti.c...
compiling stm32f10x_fsmc.c...
compiling stm32f10x_gpio.c...
compiling stm32f10x_pwr.c...
compiling stm32f10x_iwdg.c...
compiling stm32f10x_rtc.c...
compiling stm32f10x_i2c.c...
compiling stm32f10x_rcc.c...
compiling stm32f10x_sdio.c...
compiling stm32f10x_spi.c...
compiling stm32f10x_wwdg.c...
compiling main.c...
....Userusartbsp_usart1.h(11): error:  #7: unrecognized token
  void Usart_SendByte( USART_TypeDef *pUSARTx, uint8_t ch);
....Userusartbsp_usart1.h(11): error:  #130: expected a "{"
  void Usart_SendByte( USART_TypeDef *pUSARTx, uint8_t ch);
....Userusartbsp_usart1.h(12): error:  #7: unrecognized token
  void Usart_SendString( USART_TypeDef *pUSARTx, char *str);
....Usermain.c(50): warning:  #12-D: parsing restarts here after previous syntax error
  { 
....Usermain.c(52): error:  #20: identifier "b" is undefined
      for(c=0;c<b;c++)
....Usermain.c(59): warning:  #223-D: function "SPI_SPI2_Config" declared implicitly
    SPI_SPI2_Config();
....Usermain.c(60): warning:  #223-D: function "MS_Config" declared implicitly
      MS_Config();
....Usermain.c(61): warning:  #223-D: function "EXTI_IO_Config" declared implicitly
      EXTI_IO_Config();
....Usermain.c(62): warning:  #223-D: function "TIM2_Configuration" declared implicitly
      TIM2_Configuration();
....Usermain.c(88): error:  #20: identifier "INCTCD_num" is undefined
      INCTCD_num = 0x0140;
....Usermain.c(89): error:  #20: identifier "PSUMCD_num" is undefined
      PSUMCD_num = 19125/INCTCD_num;  //INCTAB_num * PSUMAB_num;              //17ms PSUMCD_num的值由 INCTCD_num决定
....Usermain.c(91): error:  #20: identifier "INCTAB_num" is undefined
      INCTAB_num = 0x4AB5;
....Usermain.c(92): error:  #20: identifier "PSUMAB_num" is undefined
    PSUMAB_num = 19125/INCTAB_num;  //INCTAB_num * PSUMAB_num;              //17ms    PSUMCD_num的值由 INCTCD_num决定
....Usermain.c(94): warning:  #223-D: function "Spi_Write" declared implicitly
   Spi_Write(0x24,0x0d00 | PSUMAB_num);     //0x0dff    
....Usermain.c(115): error:  #20: identifier "flag1" is undefined
          if(flag1==0)  // 
....Usermain.c(118): error:  #20: identifier "INCTAB_num" is undefined
             INCTAB_num = INCTAB_num - 50;   //加速  只需要把改值按照 速度曲线变化就可以改变速度,现在演示的是线性的速度变化
....Usermain.c(124): error:  #20: identifier "PSUMAB_num" is undefined
             PSUMAB_num = 19125/INCTAB_num;
....Usermain.c(125): warning:  #223-D: function "Spi_Write" declared implicitly
             Spi_Write(0x24,0x0d00 | PSUMAB_num);     //0x0dff    
....Usermain.c(129): error:  #20: identifier "INCTCD_num" is undefined
                   INCTCD_num = INCTCD_num+ 30;
....Usermain.c(134): error:  #20: identifier "PSUMCD_num" is undefined
                   PSUMCD_num = 19125/INCTCD_num;
....Usermain.c(156): error:  #20: identifier "INCTAB_num" is undefined
             INCTAB_num = INCTAB_num + 30;    //减速
....Usermain.c(162): error:  #20: identifier "PSUMAB_num" is undefined
             PSUMAB_num = 19125/INCTAB_num;
....Usermain.c(163): warning:  #223-D: function "Spi_Write" declared implicitly
             Spi_Write(0x24,0x0d00 | PSUMAB_num);     //0x0dff    
....Usermain.c(167): error:  #20: identifier "INCTCD_num" is undefined
                   INCTCD_num  = INCTCD_num - 50;
....Usermain.c(172): error:  #20: identifier "PSUMCD_num" is undefined
                   PSUMCD_num = 19125/INCTCD_num;
....Usermain.c(205): warning:  #223-D: function "Delay" declared implicitly
          Delay(60);
....Usermain.c(209): error:  #20: identifier "flag1" is undefined
          flag1 = !flag1;
....Usermain.c(216): warning:  #223-D: function "Delay" declared implicitly
          Delay(60);
....Usermain.c(220): warning:  #223-D: function "MS_Rest" declared implicitly
               MS_Rest();
....Usermain.c(221): warning:  #223-D: function "MS_Int1" declared implicitly
               MS_Int1();
....Usermain.c(224): error:  #20: identifier "INCTCD_num" is undefined
              INCTCD_num = 0x0120;
....Usermain.c(225): error:  #20: identifier "PSUMCD_num" is undefined
              PSUMCD_num = 19125/INCTCD_num;  //INCTAB_num * PSUMAB_num;              //5ms
....Usermain.c(227): error:  #20: identifier "INCTAB_num" is undefined
              INCTAB_num = 0x4AB5;
....Usermain.c(228): error:  #20: identifier "PSUMAB_num" is undefined
              PSUMAB_num = 19125/INCTAB_num;  //INCTAB_num * PSUMAB_num;              //5ms    
....Usermain.c: 12 warnings, 22 errors
compiling stm32f10x_usart.c...
compiling bsp_usart1.c...
....Userusartbsp_usart1.h(11): error:  #7: unrecognized token
  void Usart_SendByte( USART_TypeDef *pUSARTx, uint8_t ch);
....Userusartbsp_usart1.h(11): error:  #130: expected a "{"
  void Usart_SendByte( USART_TypeDef *pUSARTx, uint8_t ch);
....Userusartbsp_usart1.h(12): error:  #7: unrecognized token
  void Usart_SendString( USART_TypeDef *pUSARTx, char *str);
....Userusartbsp_usart1.c(28): warning:  #12-D: parsing restarts here after previous syntax error
  {
....Userusartbsp_usart1.c(89): error:  #20: identifier "SendBuff" is undefined
          DMA_InitStructure.DMA_MemoryBaseAddr = (u32)SendBuff;
....Userusartbsp_usart1.c(128): error:  #247: function "Usart_SendByte"  has already been defined
          void Usart_SendByte( USART_TypeDef *pUSARTx, uint8_t ch)
....Userusartbsp_usart1.c: 1 warning, 5 errors
compiling stm32f10x_it.c...
compiling stm32f10x_tim.c...
compiling bsp_SPI.c...
compiling bsp_41908.c...
compiling bsp_exti.c...
compiling bsp_TiMbase.c...
"....OutputTemplate.axf" - 27 Error(s), 13 Warning(s).
Target not created.
Build Time Elapsed:  00:00:03

 

 

 

 

引用网友解决办法:

..main.c(173): error:  #7: unrecognized token

这个错误可能是拷贝的时候,中间有中文,或者其他不能识别的,看不见的字符。keil 编译的时候就会出错。

解决:找到那一行,删除那些不可见的字符即可。

最后

以上就是腼腆雪糕为你收集整理的中文字符在Keil中导致的错误问题(错误代码:#7 #12-D #20 #223-D #247)的全部内容,希望文章能够帮你解决中文字符在Keil中导致的错误问题(错误代码:#7 #12-D #20 #223-D #247)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(48)

评论列表共有 0 条评论

立即
投稿
返回
顶部