Thread: Help on compiling code

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    Derbyshire
    Posts
    2

    Help on compiling code

    Hi there,

    Recently I have download dev c++ and I`m finding really good fun.

    However I recently wrote some code and wanted to keep changing it around but at the same time keep my old code saved in seperate file. The problem was though that when the compiler compiled my new code it ran the program as if my old code was still in it even though I had cut a function out of it, the compiler still thought it was there, can anybody help at all on this issue as I`m jus a bit curious, it was almost like a ghost in the machine, freaky.

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    are you sure it's looking at the new code, and not that saved seperate file?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Sounds to me like you failed to spot an error message when you compiled your new program, and you just ended up running the old one again without realising it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    The problem was though that when the compiler compiled my new code it ran the program as if my old code was still in it even though I had cut a function out of it, the compiler still thought it was there, can anybody help at all on this issue as I`m jus a bit curious, it was almost like a ghost in the machine, freaky.
    I've had this happen many times. If you have an executable running, then it isn't overwritten and you don't get an error message.

    One way to fix it is to check the option "Minimize while executables are running", which doesn't let you restore Dev-C++ until the your program has exited. Another way is to just make sure no programs of yours are open.

    If none of the above work, delete the executable. (If it doesn't let you delete the executable, the executable is still running.)
    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.

  5. #5
    Registered User
    Join Date
    Mar 2006
    Location
    Derbyshire
    Posts
    2
    cheers I`ll give it a try

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. loop and compiling inside a code
    By MtJ in forum C Programming
    Replies: 3
    Last Post: 03-05-2006, 12:50 PM
  2. Replies: 1
    Last Post: 03-01-2006, 03:07 AM
  3. compiling c code
    By MadCow257 in forum C++ Programming
    Replies: 2
    Last Post: 02-16-2006, 09:26 AM
  4. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:33 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM