Important: Please read the Qt Code of Conduct -

Program runs on Debug but not on Release

  • Hi everyone,

    I have quite a weird problem.
    Ive made a program, with Qt creator 3.2.1 based on Qt 5.3.2, MSVC 2010, 32 bit.

    If i run my program through qtcreator, on debug mode, without any breakpoint at all, it works fine.
    If i run my program through qtcreator, on release mode, i get the following error message

    Starting program.exe...
    The program has unexpectedly finished
    program.exe crashed

    To be sure that the problem is not with QtCreator, Ive copied the executable placed on the release folder, to a new folder with the proper dlls necesary for it to run, and well, it doesnt.
    Any idea why im having this weird behaviour?
    Ive uninstalled Qt, thinking that maybe I could have accidently messed my installation of Qt, but this didnt help.

    Thanks in advance!

  • The memory layout is not optimized in debug build so writing across the boundaries of an array may have no impact to the application. In release the chance to hit something important is quite higher. You could use printing to cout to narrow where your application is crashing.

  • sneubert described already the most likely result. However, the cause may be anything.

    In a traditional console application you may use cout for tracking purposes. However, that will not work for an application with a GUI.
    I prefer to use qDebug() you advantages when using together with Qt creator since the output can be found also in the application output window.

    Best to start is having a qDebug output right at the beginning were your application starts. When you do not see even this output, it is possibly an issue with static objects and their initization sequence.

    However, most of the issue you need to go forward step by step and you know teh details of your application.

    Good luck.

Log in to reply