Thread: Code::Blocks problem

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    89

    Code::Blocks problem

    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?

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    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.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    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.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    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.

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    It's likely, since GCC gives that warning even in ANSI mode. Yep.
    "The ISO C standard, section 5.1.1.2, states that source files must end with
    new lines."
    http://www.thescripts.com/forum/thread444292.html

    Not sure about the C++ standard, but it would make sense that it requires it too.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    278
    Yes i have faced this too! Hit some enters at the last line and then compile! I think that will do!

  7. #7
    Registered User
    Join Date
    Jan 2007
    Posts
    89
    Thanks...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM