Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78071

QMake forcibly defines NDEBUG on windows.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.13.2, 5.14.0 Alpha
    • 5.12.4, 5.13.1
    • Build tools: qmake
    • None
    • Any windows using the MSVC compiler.
    • Windows
    • 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

          For Gerrit Dashboard: QTBUG-78071
          # Subject Branch Project Status CR V

          Activity

            People

              jbornema Joerg Bornemann
              dlwilliams Dan Williams
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes