Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Whats this Error mean?

Reply
Thread Tools

Whats this Error mean?

 
 
Weasel
Guest
Posts: n/a
 
      11-09-2005
This occured right after i tryed to compile the file


hello.cpp:9:2: warning: no newline at end of file

 
Reply With Quote
 
 
 
 
Thomas Tutone
Guest
Posts: n/a
 
      11-09-2005
Weasel wrote:
> This occured right after i tryed to compile the file
>
>
> hello.cpp:9:2: warning: no newline at end of file


Uhhmmm... it means what it says. The last character of the file is
supposed to be a newline. Open the file. Go to the end. Hit <Enter>
(or whatever the equivalent is on your keyboard). Save the file.
Recompile. The warning should be gone.

By the way - it was a warning, not an error. It didn't stop you from
compiling the file, but making the above change will make the compiler
stop giving you that warning. But you should consult your compiler
documentation for more info.

Best regards,

Tom

 
Reply With Quote
 
 
 
 
Weasel
Guest
Posts: n/a
 
      11-09-2005
o ok ty ty ty sorry im just learning c++

 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      11-09-2005
Weasel wrote:

> o ok ty ty ty sorry im just learning c++


That's nice. Are you still learning how to use Google? I know I've
mentioned the quote thing to you before? Why are you not using it?


Brian

--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
 
Reply With Quote
 
Greg Comeau
Guest
Posts: n/a
 
      11-11-2005
In article <(E-Mail Removed) .com>,
Weasel <(E-Mail Removed)> wrote:
>This occured right after i tryed to compile the file
>hello.cpp:9:2: warning: no newline at end of file


Comeau, in strict mode, gives:

error: last line of file ends without a newline

In other modes it might just be a warning.
In C mode, the diagnostic can be removed.


As both these compilers are saying, source files should
end with a newline. The C++ Standard says in 2.1p2:
"If a source file that is not empty does not end in a new-line
character, or ends in a new-line character immediately
preceded by a backslash character, the behavior is undefined."
C99 5.1.1.2p2 reads:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character
before any such splicing takes place."

This normally occurs as a result of a text editor that does not
put out a trailing NL in a text file. It may also indicate that
somehow the rest of a file got tossed, though that would also
normally give some other errors if it got cut off so abruptly.
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
whats this error?? Neo VHDL 4 01-31-2005 12:47 PM
Whats the error:- System.NullReferenceException: =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 5 11-01-2004 11:29 PM
Help! Whats this error and how do i get rid of it Lucas Zieland Computer Support 2 10-19-2003 05:27 PM
Re: whats this error about? Rusty Shackleford Computer Support 1 08-25-2003 04:04 AM
Re: whats this error about? °Mike° Computer Support 3 08-12-2003 07:13 PM



Advertisments