473,396 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Whats this Error mean?

This occured right after i tryed to compile the file
hello.cpp:9:2: warning: no newline at end of file

Nov 9 '05 #1
4 3453
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

Nov 9 '05 #2
o ok ty ty ty sorry im just learning c++ :(

Nov 9 '05 #3
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.
Nov 9 '05 #4
In article <11**********************@g44g2000cwa.googlegroups .com>,
Weasel <We********@gmail.com> 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?
Nov 11 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rakesh | last post by:
Okay here is my question. I have an XSD and two pieces of xml that look like this: snippet1: <myTag myattr="someVal"></myTag> snippet2: <myTag myattr="someVal"/>
1
by: Steve1 via DotNetMonster.com | last post by:
Hi all, Why is the last line of this code snippit pulling up with an error? Any help will be appreciated - Thanks, Steve. string str_SQLLayoutsPound = "SELECT * FROM Layouts ORDER BY Name";...
1
by: aa | last post by:
When I am reading from local disk (d:), everithing is OK, but then I am reading from map disk I am geting the this error. Whats wrong. Thanks Server Error in '/Extra' Application....
3
by: mahsa | last post by:
Hi do you know whats wrong with this code? <asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');"...
4
by: sophie | last post by:
Whats going on here: Read in a number as a string: scanf("%s", &number); number = 12345, for arguements sake Print it like this its fine:
20
by: Snis Pilbor | last post by:
Whats the point of making functions which take arguments of a form like "const char *x"? It appears that this has no effect on the function actually working and doing its job, ie, if the function...
1
by: Abubakar | last post by:
Hi, In my application, Some of my thread gets stuck somewhere. The vs2k5 debugging "Thread" window shows that stuck thread and I can I dentify it. In its Name column the following text is...
0
by: cuddles | last post by:
hi im using IBM DB2 version 8 i have a procedure that should delete an error log table DELETE FROM TABLE1.ERR_MSG_LOG WHERE DATE(CRT_S) < (CURRENT DATE - 30 DAYS); but i keep...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.