Solutions to implicitly declared functions and undefined problems

I followed the course how to use a serial port today.After I wrote all the codes,two errors occurred.I spent much time to find out how to solve the program.After continuous efforts,it was solved.So I want to share two kinds of errors,in order to solve quickly the next time it appears.

..\..\Drivers\SYSTEM\usart\usart.c(55): error:  #20: identifier "USART" is undefined
      USART->DR = (uint8_t)ch; 

'The first error is' error: #20: identifier "xxx" is undefined'.What problem made it arise?It's the reason that I didn't defined 'USART',I just defined'USART1'Just revised 'USART' to 'USART1'.

..\..\Drivers\SYSTEM\usart\usart.c(106): warning:  #223-D: function "HAL_NVIC_ENABLEIRQ" declared implicitly
          HAL_NVIC_ENABLEIRQ(USART1_IRQn);

The second error is' warning: #223-D: function "xxx" declared implicitly'.

This question had bothered me for a long time.Until I found this bug and found it very simple. Just add '——' in front of HAL.After that,it's ok.

Therefore, we need to be careful when programming.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容