December 6th, 2004, 09:55 PM
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:
/* 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 */
And Here is my compile log:
Compiler: Default compiler
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
December 6th, 2004, 10:10 PM
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.
December 6th, 2004, 10:21 PM
Thanks alot that was the problem. I needed a new line at the end. No warning messages now.