-
December 6th, 2004, 09:55 PM
#1
Junior Member
warning: no newline
I'm having a problem with a warning message and would be greatfull if someone could help me get it removed. The program runs but it has a warning message that I can't seem to get rid of. I am using the latest version of Dev-C++. The code is:
#include <iostream>
#include <stdlib.h>
int main()
{
using std::cout;
/* this is a comment
and it extends until the closing
star-slash comment mark */
cout << "Hello World!\n";
// this comment ends at the end of the line
cout << "That comment ended!\n";
// double slash comments can be alone on a line
/* as can slash_star comments */
system("pause");
return 0;
}
And Here is my compile log:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\C++ In 21 Days Demostrations\Listing 2.5.cpp" -o "C:\Dev-Cpp\C++ In 21 Days Demostrations\Listing 2.5.exe" -I"C:\DEV-CPP\include\c++\3.3.1" -I"C:\DEV-CPP\include\c++\3.3.1\mingw32" -I"C:\DEV-CPP\include\c++\3.3.1\backward" -I"C:\DEV-CPP\lib\gcc-lib\mingw32\3.3.1\include" -I"C:\DEV-CPP\include" -L"C:\DEV-CPP\lib"
C:/Dev-Cpp/C++ In 21 Days Demostrations/Listing 2.5.cpp:19:2: warning: no newline at end of file
Execution terminated
Compilation successful
Thanks Bondojoe
-
December 6th, 2004, 10:10 PM
#2
Have you tried adding in a newline at the end of the file? I know it sounds stupid, but it's worth a try. Apart from that, there isn't any syntactical problem with your code...nothing that would give you a compiler warning.
Did you copy and paste the code, or download it from somewhere? That could be the problem (although I really can't see why it would be :P) Hope that helps you.
ac
-
December 6th, 2004, 10:21 PM
#3
Junior Member
Thanks alot that was the problem. I needed a new line at the end. No warning messages now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|