警告:文件末尾没有新行 [英] warning : no new line at end of file

查看:80
本文介绍了警告:文件末尾没有新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我编译我的C程序(甚至2行编程)时会发出警告,在文件末尾没有

新行。

这是什么意思?

-Regards,

Sameer

解决方案

您好,


您能否输入您要编译的程序。


如果您告诉我们会对您有所帮助我们的编译环境。

例如使用OS和编译器版本。


Rahul


Sameer <恩****** @ gmail.com>写道:

当我编译我的C程序(甚至2行编程)时发出警告,文件末尾没有
新行。
这是什么意思?



这意味着文件末尾没有换行符。你觉得怎么样?b $ b这意味着什么?


在文本编辑器中,在文件末尾添加换行符

试图编译。 (有些编辑自动执行此操作;你的

显然不是。)


-

Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。


" Sameer" <恩****** @ gmail.com>写道:

当我编译我的C程序(甚至2行编程)时发出警告,文件末尾没有
新行。




这意味着,惊喜,惊喜,你的源文件结尾没有新行。

你的源文件。标准版:


#非空的源文件应以换行符结尾


Richard


Hi,
when i compile my C programs (even 2 line progs) give the warning, no
new line at end of file.
What does this mean ?
-Regards,
Sameer

解决方案

Hi,

Can you please type the program you are trying to compile.

It would be helpful for us if you tell us the compilation environment.
for e.g. OS used and compiler version used.

Rahul


"Sameer" <en******@gmail.com> writes:

when i compile my C programs (even 2 line progs) give the warning, no
new line at end of file.
What does this mean ?



It means there''s no newline at the end of the file. What do you think
it means?

In your text editor, add a newline to the end of the file you''re
trying to compile. (Some editors do this automatically; yours
apparently doesn''t.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


"Sameer" <en******@gmail.com> wrote:

when i compile my C programs (even 2 line progs) give the warning, no
new line at end of file.



It means, surprise, surprise, that there is no new-line at the end of
your source file. Quoth the Standard:

# A source file that is not empty shall end in a new-line character

Richard


这篇关于警告:文件末尾没有新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆