Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.4, 5.13.1
-
None
-
Any windows using the MSVC compiler.
-
-
1456b8091a681316f0e6256554fd138c6399f564 (qt/qtbase/5.13)
Description
QMake forcibly disables assertions with no way to re-enable them when doing release builds on windows with visual studio. This is unexpectedly different from other platforms, and causes problems with debugging optimized applications on this platform.
I have attached a sample program that demonstrates the problem. It is simply a default project from QtCreator with an assertion added before the main window opens. On Linux this behaves as expected (the assertion is triggered), but on Windows the assertion is skipped.
Steps to reproduce:
in the directory of the attached project run "mkdir build && cd build && qmake .. && nmake && release\AssertionTest.exe"
Expected Behavior:
The application should exit with an assertion before showing a window.
Actual Behavior:
The application executes successfully.
Workaround:
This can be worked around by adding the following line in the project file:
DEFINES += NDEBUG "FIX_NDEBUG -UNDEBUG"
This is a bit of an abuse of qmake's parsing though, and adds an extra define that we don't really care about.
Attachments
Issue Links
- resulted from
-
QTBUG-3389 Add NDEBUG to the list of defines when generating the makefile for release builds
- Closed
- resulted in
-
QTBUG-81569 qmake: NDEBUG macro always added, regardless of configuration
- Closed