Thread: Problem running in non-debug mode

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688

    Problem running in non-debug mode

    Hey guys

    I usewxDev-C++ 6.10.2. When I create a project and run it in debug mode it works fine and I get no problems. If however I do a normal execution click "compile and run" or just "run" it executes but only showing a black screen with no data.

    Have I accidently clicked somthing on the IDE that prevents me from running it in non-debug mode? I have searhed the help files but got no answers.

    I apprieciate any help
    Double Helix STL

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I don't think I have any direct answer, but here's a few hints.

    There are many things that CAN change when you go from debug to "release" or "optimized" compiles of the code. Some of these will change the behavior of the code...

    These are places to watch out for:
    1. Variables that are updated "outside" of the code, e.g. a while or if-condition that is updated by a different function or thread, where the compiler may not take this into account. [Usually because of pointer aliasing or such if it's not multi-threaded].

    2. Compiler optimizations change the code behavior in itself.

    3. Assert or debug statements with side-effects. E.g. "assert(drawpixels(img, x, y, w, h))" will not be compiled in the release build, so there will be no pixels drawn.

    Some things to try:
    A. One thing you may want to try is a comparison between the "no debug" and the "debug" code, with no other differences - So no optimization, but no debug either. That will tell you if it's the lack of debug code, rather than the optimization that causes the problem.

    B. Adding printf or other logging to see the chain of calls (enter/leave prints for some of your main functions) can be another way to figure out what is happening and where you are getting to. Unfortunately, this also changes the code generated by the compiler, so it may cause "heisenbugs" to disappear or change behaviour.

    C. Running in gdb and breaking when it's stopped can give you an idea of where the code is "stuck" if it's getting into a stuck situation.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug release conf problem
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 03-20-2009, 04:39 PM
  2. Why my code works only in debug mode?
    By pingpangpang in forum C++ Programming
    Replies: 3
    Last Post: 06-04-2007, 12:39 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. need help with two player mode on racecar problem
    By bugei in forum C++ Programming
    Replies: 1
    Last Post: 11-19-2003, 08:09 PM
  5. problem going into mode 13h
    By ArseMan in forum C++ Programming
    Replies: 5
    Last Post: 08-31-2001, 04:53 PM