如何消除MDK的警告warning: #1-D: last line of file ends without a newline

本文介绍如何在 C/C++ 的 MiscControls 中使用 --diag_suppress=1 参数来抑制编译器警告。当配置文件中存在其他参数时,确保与该指令间用空格隔开。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在c/c++的Misc Controls中添加--diag_suppress=1,如果里面有其他参数,请空格

Rebuild started: Project: 工程模板 *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'E:\keil5\MDK5.36\ARM\ARMCC\Bin' Rebuild target 'Target 1' assembling startup_stm32f10x_hd.s... compiling main.c... .\APP\dsgshow.h(16): warning: #1-D: last line of file ends without a newline #endif .\APP\delay.h(14): warning: #1-D: last line of file ends without a newline #endif /* __DELAY_H */ .\APP\EXTI.C(39): warning: #1-D: last line of file ends without a newline } .\APP\key.h(25): warning: #1-D: last line of file ends without a newline #endif User\main.c(27): warning: #1-D: last line of file ends without a newline } User\main.c: 5 warnings, 0 errors compiling stm32f10x_it.c... compiling misc.c... compiling beepkey.c... APP\delay.h(14): warning: #1-D: last line of file ends without a newline #endif /* __DELAY_H */ APP\beepkey.c(116): warning: #1-D: last line of file ends without a newline } APP\beepkey.c(77): warning: #177-D: variable "i" was declared but never referenced uint32_t i; // ??: ????????? APP\beepkey.c: 3 warnings, 0 errors compiling led.c... APP\led.c(32): warning: #1-D: last line of file ends without a newline } APP\led.c: 1 warning, 0 errors compiling stm32f10x_gpio.c... compiling system_stm32f10x.c... compiling stm32f10x_exti.c... compiling stm32f10x_rcc.c... compiling core_cm3.c... compiling systick.c... compiling delay.c... APP\delay.h(14): warning: #1-D: last line of file ends without a newline #endif /* __DELAY_H */ APP\delay.c(33): warning: #1-D: last line of file ends without a newline } APP\delay.c: 2 warnings, 0 errors compiling EXTI.C... APP\dsgshow.h(16): warning: #1-D: last line of file ends without a newline #endif APP\delay.h(14): warning: #1-D: last line of file ends without a newline #endif /* __DELAY_H */ APP\EXTI.C(39): warning: #1-D: last line of file ends without a newline } APP\EXTI.C: 3 warnings, 0 errors compiling key.c... APP\key.h(25): warning: #1-D: last line of file ends without a newline #endif APP\key.c(47): warning: #1-D: last line of file ends without a newline } APP\key.c: 2 warnings, 0 errors compiling dsgshow.c... APP\dsgshow.h(16): warning: #1-D: last line of file ends without a newline #endif APP\delay.h(14): warning: #1-D: last line of file ends without a newline #endif /* __DELAY_H */ APP\dsgshow.c: 2 warnings, 0 errors linking... .\Output\工程模板.axf: Error: L6200E: Symbol hour multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol minute multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol second multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol smgduan multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol smgwei multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol DsgShowInit multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol DsgShowNum multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol DsgShowTime multiply defined (by dsgshow.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol EXTI0_IRQHandler multiply defined (by stm32f10x_it.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol EXTI0_IRQHandler multiply defined (by exti.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol EXTI1_IRQHandler multiply defined (by stm32f10x_it.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol EXTI1_IRQHandler multiply defined (by exti.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol EXTI2_IRQHandler multiply defined (by stm32f10x_it.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol EXTI2_IRQHandler multiply defined (by exti.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol EXTI15_10_IRQHandler multiply defined (by exti.o and main.o). .\Output\工程模板.axf: Error: L6200E: Symbol delay_ms multiply defined (by delay.o and systick.o). .\Output\工程模板.axf: Error: L6200E: Symbol delay_us multiply defined (by delay.o and systick.o). Not enough information to list image symbols. Not enough information to list load addresses in the image map. Finished: 2 information, 0 warning and 17 error messages. ".\Output\工程模板.axf" - 17 Error(s), 18 Warning(s). Target not created. Build Time Elapsed: 00:00:01
最新发布
06-17
Rebuild started: Project: display *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\MCUSTM32\ARM\ARMCC\Bin' Rebuild target 'display' Note: source file '..\CORE\system_stm32f10x.c' - object file renamed from '.\Objects\system_stm32f10x.o' to '.\Objects\system_stm32f10x_1.o'. assembling startup_stm32f10x_md.s... compiling system_stm32f10x.c... compiling misc.c... compiling stm32f10x_gpio.c... compiling core_cm3.c... compiling stm32f10x_rcc.c... compiling main.c... ..\USER\main.h(16): warning: #1-D: last line of file ends without a newline // 空行(解决警告) ..\USER\main.c: 1 warning, 0 errors compiling stm32f10x_it.c... compiling timer.c... ..\USER\main.h(16): warning: #1-D: last line of file ends without a newline // 空行(解决警告) ..\APP\timer.h(9): warning: #1-D: last line of file ends without a newline #endif /* __TIMER_H */ ..\APP\display.h(26): warning: #1-D: last line of file ends without a newline #endif /* __DISPLAY_H */ ..\APP\timer.c: 3 warnings, 0 errors compiling systick_delay.c... compiling key.c... ..\APP\key.c(25): warning: #223-D: function "delay_ms" declared implicitly delay_ms(5); // 按键消抖 ..\APP\key.c(31): warning: #223-D: function "delay_ms" declared implicitly delay_ms(5); ..\APP\key.c(37): warning: #223-D: function "delay_ms" declared implicitly delay_ms(5); ..\APP\key.c(44): warning: #1-D: last line of file ends without a newline // 空行(解决警告) ..\APP\key.c: 4 warnings, 0 errors compiling display.c... ..\APP\display.h(26): warning: #1-D: last line of file ends without a newline #endif /* __DISPLAY_H */ ..\APP\display.c: 1 warning, 0 errors compiling stm32f10x_tim.c... linking... .\Objects\display.axf: Error: L6200E: Symbol SysTick_Handler multiply defined (by systick_delay.o and stm32f10x_it.o). Not enough information to list image symbols. Not enough information to list load addresses in the image map. Finished: 2 information, 0 warning and 1 error messages. ".\Objects\display.axf" - 1 Error(s), 9 Warning(s). Target not created. Build Time Elapsed: 00:00:02能不能修改
06-08
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值