STM32入门—Error/更新于2018/1/25

1、

//避免使用半主机模式  
_sys_exit(int x) 
{ 
    x = x; 
} 

error: #260-D: explicit type is missing (“int” assumed)
定义 _sys_exit(int x) 以避免使用半主机模式,函数没有返回类型,假定其返回类型为int,可以写为 void _sys_exit(int x) ,否则编译器会默认为返回int类型,故会出现上述警告。

解决方法:写为 void _sys_exit(int x)

2、

linking...  
.\Objects\template_demo.axf: Warning: L6304W: Duplicate input file .\objects\panel_set_preset_png_1.o ignored.  
.\Objects\template_demo.axf: Error: L6200E: Symbol panel_set_preset_png multiply defined (by panel_set_preset_png_1.o and panel_set_preset_png.o).  
.\Objects\template_demo.axf: Error: L6200E: Symbol cc multiply defined (by panel_set_preset_png_1.o and panel_set_preset_png.o).  
.\Objects\template_demo.axf: Error: L6200E: Symbol panel_set_preset_png_size multiply defined (by panel_set_preset_png_1.o and panel_set_preset_png.o).  
.\Objects\template_demo.axf: Error: L6200E: Symbol __rt_init_rti_start multiply defined (by components_1.o and components.o).  
.\Objects\template_demo.axf: Error: L6200E: Symbol __rt_init_rti_board_end multiply defined (by components_1.o and components.o).  
.\Objects\template_demo.axf: Error: L6200E: Symbol __rt_init_rti_end multiply defined (by components_1.o and components.o).  
.\Objects\template_demo.axf: Error: L6200E: Symbol rt_components_board_init multiply defined (by components_1.o and components.o).  
.\Objects\template_demo.axf: Error: L6200E: Symbol rt_components_init multiply defined (by components_1.o and components.o).  
Not enough information to list image symbols.  
Not enough information to list the image map.  
Finished: 2 information, 0 warning and 8 error messages.  
".\Objects\template_demo.axf" - 8 Error(s), 548 Warning(s).  
Target not created.  
Build Time Elapsed:  00:01:27 

工程下panel_set_preset_png.c文件被添加了两次, 然后就移除只保留一个panel_set_preset_png.c文件在工程下,重新编译后问题得到解决! 同理,移除多添加的components.c文件,后面错误也就消失了。

解决方法:工程下同一文件只能添加一次!

3、

*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'D:\MDK5.23\ARM\ARMCC\Bin'
compiling usartt.c...
..\HARDWARE\USARTT\usartt.c(19): error:  #20: identifier "FILE" is undefined
  FILE __stdout;       
..\HARDWARE\USARTT\usartt.c(26): error:  #20: identifier "FILE" is undefined
  int fputc(int ch, FILE *f)
..\HARDWARE\USARTT\usartt.c: 0 warnings, 2 errors
"..\HARDWARE\USARTT\usartt.c" - 2 Error(s), 0 Warning(s).

没有头文件

解决方法:不要忘了写函数之前引入要用的头文件

4、
写串口实验时,程序没有语法上的错误,编译通过,但是却不能实现串口通信,找了很久,发现是因为串口时钟使能和GPIO时钟使能函数找错了。这些函数长得很像,调用时要找仔细。

解决方法:调用函数时,认真仔细。

/**************更新于2018/1/25********************/
/**************欢 迎 指 正************/
5、

..\HARDWARE\HCSR04\hcsr04.c(70): warning:  #1035-D: single-precision operand implicitly converted to double-precision
              lengthTemp = ((float)t/58.0);//cm  
..\HARDWARE\HCSR04\hcsr04.c(74): warning:  #1035-D: single-precision operand implicitly converted to double-precision
          lengthTemp = sum/5.0;  

single-precision operand implicitly converted to double-precision 这句话的意思就是单精度运算隐式转换成了双精度运算了。

解决方法:在单精度数字后面加个f

你可能感兴趣的:(控制组-学习总结)