I have been using Dev-Cpp compiler and have just switched to Code::Blocks
My code compiles just fine with Dev-Cpp, but code blocks gives me a "no new line at end of file warning"
What is that?
Printable View
I have been using Dev-Cpp compiler and have just switched to Code::Blocks
My code compiles just fine with Dev-Cpp, but code blocks gives me a "no new line at end of file warning"
What is that?
it isnt a problem it is just saying there isnt a newline at the end of your source files. Also, if you have an up to date version of code::blocks, it will add the newline automatically.
The OP probably took the source file verbatim from Dev-C++ and compiled it with Code::Blocks. I don't think that Dev-C++ automatically adds newlines to the ends of files.
Something vague in my memory tells me it might even be a requirement from the C++ standard that all source files end with a newline. I have no idea if that is correct, though.
It's likely, since GCC gives that warning even in ANSI mode. Yep.
http://www.thescripts.com/forum/thread444292.htmlQuote:
"The ISO C standard, section 5.1.1.2, states that source files must end with
new lines."
Not sure about the C++ standard, but it would make sense that it requires it too.
Yes i have faced this too! Hit some enters at the last line and then compile! I think that will do!
Thanks...