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文件,後面錯誤也就消失了☺

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章