public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help : File does not end with newline
@ 2001-09-30  9:26 Paul Lim
  2001-09-30  9:44 ` Jeff Sturm
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Lim @ 2001-09-30  9:26 UTC (permalink / raw)
  To: gcc-help; +Cc: gcc

Hi,

A good day to you. I am a newbie. I hope the guru can advise me on the 
following.

I am using gcc to compile my C source file with the following command
gcc -Wall -pedantic -ansi -g -o diary menu.c

The thing is menu.c has a include file which i put in the first line as
#include "diary.h"

However, I did not successful compile. The error message is
diary.h:103: warning: file does not end in newline

The last line of diary.h is already 103 and I cannot find any problem. I 
have dissected my code to the smaller modules to try to track the error but 
still cannot find the error.

I have previously managed to compile cleanly with the option
gcc -o diary.c

I am using gcc on Windows. Could OS be the problem?

Could someone please advise me on roughly where the problem is?

I sincerely appreciate your help.
Thank you very much.

Sincerely
Paul

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help : File does not end with newline
  2001-09-30  9:26 Help : File does not end with newline Paul Lim
@ 2001-09-30  9:44 ` Jeff Sturm
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Sturm @ 2001-09-30  9:44 UTC (permalink / raw)
  To: Paul Lim; +Cc: gcc-help, gcc

On Sun, 30 Sep 2001, Paul Lim wrote:
> However, I did not successful compile. The error message is
> diary.h:103: warning: file does not end in newline

This means the last few characters of diary.h are not a valid line
terminator, e.g. \n or \r\n.

> I am using gcc on Windows. Could OS be the problem?

Not directly.  But Windows does seem to have a plethora of broken editor
software.  Try to open/save this file in another source code editor, such
as emacs or even Windows Notepad.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help : File does not end with newline
  2001-09-30 17:44 Paul Lim
@ 2001-09-30 18:21 ` Zack Weinberg
  0 siblings, 0 replies; 6+ messages in thread
From: Zack Weinberg @ 2001-09-30 18:21 UTC (permalink / raw)
  To: Paul Lim; +Cc: dewar, jsturm, gcc-help, gcc

On Mon, Oct 01, 2001 at 12:40:57AM +0000, Paul Lim wrote:
> Hi to all,
> 
> Zack, I have attached my file here for you to check. I have verified that 
> the file attached to you does not compile cleanly i.e it has the "File does 
> not end with newline" warning.

Is the *only* diagnostic message that you get the "File does not end
in newline" warning?  That is the only message I get.

If it is, well, that is a correct warning.  The last line of the
diary.h that I received does not have any end-of-line marker on it.
You can probably fix the file with your usual text editor by going to
the end of the last line, hitting RETURN, and then saving the file.
Please note that this is a *warning*, not an error; your program will
still be compiled successfully even if you do not fix the file.

I am suspicious that I did not receive the exact same file as you have
on your system.  The file I received has Unix line endings (0x0a only)
whereas Windows uses DOS line endings (two bytes, 0x0d 0x0a).  It
seems likely to me that the program you used to create the zipfile
converted diary.h to its idea of a canonical format, destroying the
information I need.

Please download GZIP.EXE from http://www.gzip.org/ , apply it to
diary.h (producing diary.h.gz or possibly diary.gz) and send me that
file.  I do not need to see any of the other files again.

zw

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help : File does not end with newline
@ 2001-09-30 17:44 Paul Lim
  2001-09-30 18:21 ` Zack Weinberg
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Lim @ 2001-09-30 17:44 UTC (permalink / raw)
  To: zack, dewar; +Cc: jsturm, gcc-help, gcc

[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]

Hi to all,

Zack, I have attached my file here for you to check. I have verified that 
the file attached to you does not compile cleanly i.e it has the "File does 
not end with newline" warning.

I have followed the method recommended by Jeff. I opened up my .h file under 
Unix vi and saved it again. It then managed to compile cleanly without any 
error.

For your information and necessary action.

Thank you once again for all your advise.

Sincerely
Paul

>From: Zack Weinberg <zack@codesourcery.com>
>To: dewar@gnat.com
>CC: jsturm@one-point.com, paullimjh@hotmail.com, gcc-help@gcc.gnu.org, 
>gcc@gcc.gnu.org
>Subject: Re: Help : File does not end with newline
>Date: Sun, 30 Sep 2001 14:43:43 -0700
>
>On Sun, Sep 30, 2001 at 12:58:42PM -0400, dewar@gnat.com wrote:
> > <<Not directly.  But Windows does seem to have a plethora of broken 
>editor
> > software.  Try to open/save this file in another source code editor, 
>such
> > as emacs or even Windows Notepad.
> > >>
> >
> > Note that it is entirely within normal Windows standards for the last
> > character in the file to be 0x1A, you can even argue that this is the
> > standard format, so many editors in Windows put this character there,
> > but typical Unix software is not setup to properly handle this end
> > of file character on Windows, so perhaps that is the problem.
>
>If this turns out to be the problem, I am willing to add code to
>cpplib to recognize 0d 0a 1a EOF as a proper end of file.  Before
>doing that, though, I would like to see the complete error log
>reported by the compiler.  "warning: no newline at end of file" is not
>a fatal error; if that was the only problem reported, compilation
>would have succeeded.  There must have been at least one more error
>message.  (If the problem is a trailing 0x1a, gcc should have printed
>"stray '\32' in program").
>
>I would also like to see the complete contents of diary.h, in a format
>guaranteed to preserve control characters (for instance, gzipped and
>then MIME-attached or uuencoded).
>
>zw


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

[-- Attachment #2: Paul.zip --]
[-- Type: application/zip, Size: 7352 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help : File does not end with newline
  2001-09-30 10:02 dewar
@ 2001-09-30 14:47 ` Zack Weinberg
  0 siblings, 0 replies; 6+ messages in thread
From: Zack Weinberg @ 2001-09-30 14:47 UTC (permalink / raw)
  To: dewar; +Cc: jsturm, paullimjh, gcc-help, gcc

On Sun, Sep 30, 2001 at 12:58:42PM -0400, dewar@gnat.com wrote:
> <<Not directly.  But Windows does seem to have a plethora of broken editor
> software.  Try to open/save this file in another source code editor, such
> as emacs or even Windows Notepad.
> >>
> 
> Note that it is entirely within normal Windows standards for the last
> character in the file to be 0x1A, you can even argue that this is the
> standard format, so many editors in Windows put this character there,
> but typical Unix software is not setup to properly handle this end
> of file character on Windows, so perhaps that is the problem.

If this turns out to be the problem, I am willing to add code to
cpplib to recognize 0d 0a 1a EOF as a proper end of file.  Before
doing that, though, I would like to see the complete error log
reported by the compiler.  "warning: no newline at end of file" is not
a fatal error; if that was the only problem reported, compilation
would have succeeded.  There must have been at least one more error
message.  (If the problem is a trailing 0x1a, gcc should have printed
"stray '\32' in program").

I would also like to see the complete contents of diary.h, in a format
guaranteed to preserve control characters (for instance, gzipped and
then MIME-attached or uuencoded).

zw

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help : File does not end with newline
@ 2001-09-30 10:02 dewar
  2001-09-30 14:47 ` Zack Weinberg
  0 siblings, 1 reply; 6+ messages in thread
From: dewar @ 2001-09-30 10:02 UTC (permalink / raw)
  To: jsturm, paullimjh; +Cc: gcc-help, gcc

<<Not directly.  But Windows does seem to have a plethora of broken editor
software.  Try to open/save this file in another source code editor, such
as emacs or even Windows Notepad.
>>

Note that it is entirely within normal Windows standards for the last
character in the file to be 0x1A, you can even argue that this is the
standard format, so many editors in Windows put this character there,
but typical Unix software is not setup to properly handle this end
of file character on Windows, so perhaps that is the problem.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-09-30 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-30  9:26 Help : File does not end with newline Paul Lim
2001-09-30  9:44 ` Jeff Sturm
2001-09-30 10:02 dewar
2001-09-30 14:47 ` Zack Weinberg
2001-09-30 17:44 Paul Lim
2001-09-30 18:21 ` Zack Weinberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).