STM8 使用printf报错

2019-03-23 17:32发布

使用STVD编译器,重定义printf函数后,使用的时候报错
下面是程序
#define __GNUC__

#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif  

PUTCHAR_PROTOTYPE  
{  
  /* Write a character to the USART */  
//  USART_SendData8(EVAL_COM1, c);  
  /* Loop until the end of transmission */  
//  while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET);  
  UART1->DR=(ch);
  /* Loop until the end of transmission */
   while (!(UART1->SR & UART1_FLAG_TXE));

  return (ch);  
}
下面是报错内容

#error clnk Debugspwm1.lkf:1 symbol _memchr not defined ((C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)dtog.o )
#error clnk Debugspwm1.lkf:1 symbol _strlen not defined ((C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)cprint.o )
#error clnk Debugspwm1.lkf:1 symbol _toupper not defined ((C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)cprint.o )
#error clnk Debugspwm1.lkf:1 symbol _putchar not defined ((C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)cprint.o )
#error clnk Debugspwm1.lkf:1 symbol __udiv not defined ((C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)dtoe.o (C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)cnorm.o )
#error clnk Debugspwm1.lkf:1 symbol __itob not defined ((C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)cprint.o )
#error clnk Debugspwm1.lkf:1 symbol __ltob not defined ((C:Program Files (x86)COSMICCXSTM8_32KLiblibfs0.sm8)cprint.o )
The command: "clnk -l"C:Program Files (x86)COSMICCXSTM8_32KLib" -l"C:Program Files (x86)COSMICCXSTM8_32KLib"  -o Debugspwm1.sm8 -mDebugspwm1.map Debugspwm1.lkf " has failed, the returned value is: 1
exit code=1.
求大神帮助
此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。