使用新手MDK时候,有关警告:last line of file ends without a newline解决办法

本文介绍了解决Keil软件编译时出现的#1-D警告的具体步骤。即使遵循了常见建议,如删除多余换行并确保光标位置正确,有时仍然会出现此问题。文章提供了额外的操作来彻底解决这一顽固警告。

Keil软件编译的时候,总会出现一个问题:
warning:  #1-D: lastline of file ends without a newline!如下图所示:


百度下结局办法就是

将光标移到提示告警的代码最后一行(有代码的那一行)然后按住del键,直到确定下面没有回车行,最后回车一下或多下即可。
但是,我的编译器还是会报同样的错误,不知道是我的KEIL原因还是电脑设置的原因。

解决的的办法就是,在上边的的方法后再按一个删除键。一定要确保上面方法回车一下时候,光标在最开始的位置,而不是空一格。

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
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值