473,799 Members | 3,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3467
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************ **********@g44g 2000cwa.googleg roups.com>,
Weasel <We********@gma il.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
1449
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
1343
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"; OleDbCommand obj_SQLLayoutsPound = new OleDbCommand( str_SQLLayoutsPound, obj_SourceConn ); OleDbDataReader obj_ReaderLayoutsPound = obj_SQLLayoutsPound.ExecuteReader(); while( obj_ReaderLayoutsPound.Read())
1
2468
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. ---------------------------------------------------------------------------- ---- The specified user does not exist. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more...
3
2044
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');" %>'>Need Help?</asp:HyperLink> -- mahsa
4
2772
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
2475
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 doesn't write to x, then it doesnt seem like the compiler could care less whether I specify the const part. Quite the opposite, if one uses const liberally and then later goes back and changes the functions, headaches will inevitably occur as...
1
7557
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 written: "std::_Container_base::_Orphan_all". What does this mean? Now some general info about whats happnening here: :this is a call to a SendMessage api, which I'm sending to my GUI window, and this call never makes it back. I have checked the GUI...
0
1299
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 getting this error: A database manager error occurred. CLI0604E CallableStatement get*** method was called without calling execute. SQLSTATE=S1010
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10470
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10023
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9067
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5583
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.