wfs081 发表于 2010-7-25 17:11:40

STM32程序从KEIL转换为IAR出错

网购的开发板,例程是keil的,例程很多,我现在常用的是IAR,在移植LCD显示时很容易就成功了,但是在移植含串口程序时,出现大量如下类型错误.敬请各位高手指导。源文件免费开放敬请莅临指导。

错误类型如下:
Error: expected a ";" F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 57
Error: a declaration here must declare a parameter F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 173
Error: invalid storage class for a parameter F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 181
Error: a declaration here must declare a parameter F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 181
Warning: explicit type is missing ("int" assumed) F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 181
Error: expected a ";" F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 181
Error: invalid storage class for a parameter F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 192
Error: a declaration here must declare a parameter F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 192
Warning: explicit type is missing ("int" assumed) F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 192
Error: "__declspec" has already been declared in the current scope (at line 181) F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\stdio.h 192

错误对应的一些语句摘录如下:
unsigned __int64 __pos;   // Error: expected a ";"
extern _ARMABI int remove(const char * /*filename*/);   //Error: a declaration here must declare a parameter
extern _ARMABI FILE *tmpfile(void);   //Error: "__declspec" has already been declared in the current scope (at line 181)

备注:_ARMABI的定义:#define _ARMABI __declspec(__nothrow)

june4th 发表于 2010-7-25 17:54:11

没必要自己写stdio.h吧,用系统自己带的就行。
莫非这个程序也用到了printf,原作者发现了MDK的知名bug?

wfs081 发表于 2010-7-25 20:47:10

回复【1楼】june4th
-----------------------------------------------------------------------
这是KEIL系统自带的stdio文件,照搬过来的;
建议很不错,改用了iar自带的stdio.h,解决了绝大部分问题,目前问题是:
Error: identifier "FILE" is undefined F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\Retarget.c 21
Error: identifier "FILE" is undefined F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\Retarget.c 24
Error: identifier "FILE" is undefined F:\KEIL--TO--IAR\MYPROJECT\USART-LCD-ADC\Retarget.c 26

我再瞧瞧原因,十分感谢楼上。

至于选用IAR完全出于公司工作需要,公司都是采用的IAR的。

conter 发表于 2010-7-25 20:51:57

有没有在IAR里添加头文件?
IAR里的头文件是直接#include包含的,不用添加到工程里来

june4th 发表于 2010-7-25 20:52:51

http://cache.amobbs.com/bbs_upload782111/files_31/ourdev_570642.png
(原文件名:无标题g.png)

选择IAR是对的,比Keil-MDK好使多了。

honami520 发表于 2010-7-25 21:05:04

full怎么啦?

wfs081 发表于 2010-7-25 23:14:57

回复【3楼】conter
--------------------------------------------------------------------
是的,有包含的,可以设置。$PROJ_DIR$\------

wfs081 发表于 2010-7-25 23:18:12

回复【4楼】june4th 朴正欢
-----------------------------------------------------------------------

谢谢,我试试。
页: [1]
查看完整版本: STM32程序从KEIL转换为IAR出错