Is there a way to build Qt in "Release with Debug info" mode ? My application crashes only in "release" mode (works fine in Debug mode) and seems the issue comes from Qt (may be a bug in Qt).So I want to see the debug info of Qt.
Qt docs has "debug" , "release" but not "release with debug" mode.
[Upate]
My application works fine with Mingw 32bit Release/Debug and VSC++ Compiler 64bit Debug.
Only crashes on VSC++ 64Bit Release
Any tips ?
You can now debug your release build application. To find a problem, step through the code (or use Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.
In Solution Explorer, right-click the project and choose Properties. In the side pane, choose Build (or Compile in Visual Basic). In the Configuration list at the top, choose Debug or Release. Select the Advanced button (or the Advanced Compile Options button in Visual Basic).
Old question, I know. But nowadays, you can simply use
CONFIG += force_debug_info
to get debug symbols even in release mode. When you use QMake
via the command line, I usually do this to get a release build with debug info:
qmake CONFIG+=release CONFIG+=force_debug_info path/to/sources
this will enable below conditions of Qt5/mkspecs/features/
default_post.prf:
force_debug_info|debug: CONFIG += debug_info force_debug_info { QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO }
which would even work for Qt 4.x
but we would need to manually append above conditions into default_post.prf
for Qt 4.x
I use this in my qmake files to build my release versions with debuginfo:
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
This way you can at least check if the crash happens in your code. Building Qt with this mode is not supported, see this bug. You can only do it manually by changing vcproj-files or Makefiles like in the answer of Macke.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With