Error: L6200E: Symbol xxx multiply defined 和Warning: L6304W: Duplicate input file

keil5编译报以下错误:
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

以.第一条错误\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).为例,刚开始以为是panel_set_preset_png变量在panel_set_preset_png_1.c和panel_set_preset_png.c文件中都有定义,所以导致的这个错误,然后搜索发现并不存在所谓的panel_set_preset_png_1.c文件工程文件夹下只有panel_set_preset_png.c一个文件也就不存在所谓的多重定义!郁闷了好久,因为一些原因换了keil版本,之前用keil编译都是通过的也没有报错,换了个keil版本就出现了这个问题(后来想想,xx之前的版本为什么不报这些错误,换了版本就开始报错了!)各种方法什么重新设置头文件路径文件删了重新加,总之浪费了我很多时间。


最后功夫不负有心人,在查看工程添加文件的时候发现,工程下panel_set_preset_png.c文件被添加了两次

然后就移除只保留一个panel_set_preset_png.c文件在工程下,重新编译后问题得到解决!

同理,移除多添加的components.c文件,后面错误也就消失了☺

你可能感兴趣的:(C语言,Keil单片机)