在IAR工程.c文件末尾添加一个自己的函数,出现了报错Error[Pa045]: function "halUartInit" has no prototype
意思是没有在开头添加函数声明,即void halUartInit(void);
这个问题我们在keil中不会遇到,这是因为IAR编译器规则的一个设置造成的。
解决办法:
法一(推荐):我们需要关闭Options->C/C++ Compiler->Language1中的Require Prototypes
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/8faa20d6942e48149edf46e928bceb8f.png)
法二:在.c文件添加函数声明
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/dd80ac0e3da6430ca49ba1b50c6e1219.png)