QMAKE_CFLAGS += -Zi does not work



  • Hi,
    I have a problem with QMake / Qt Creator 3.0.1

    I need to debug a "release" program, to find a bug. The debug version of that program works. So I tried to set my Compiler-Options (Visual Studio 2010 C++) with QMAKE_CFLAGS as above shown. I tried the same with QMAKE_CFLAGS_RELEASE, it does not work, next I changed the qmake.conf from the Qt folder (...\qtbase\mkspecs\win32-msvc2010\qmake.conf). Qt Version is 5.2.1.

    Thank you for each help...
    Regards,
    Peter



  • There is no documented QMAKE_CFLAGS variable.
    http://qt-project.org/doc/qt-5/qmake-variable-reference.html

    You want QMAKE_CXXFLAGS, QMAKE_CXXFLAGS_DEBUG, or QMAKE_CXXFLAGS_RELEASE for C++ code.
    @
    QMAKE_CXXFLAGS += -Zi
    @
    You need to rerun qmake after changing this in your PRO file.



  • Hi, ChrisW67

    Please use QtCreator, add the variable QMAKE_CFLAGS to the pro file, mark it an press F1. If you have installed the helpfiles 5.2 you will se, it is documented. Not good, but it is there. Help files from Qt 4.8.5 miss this...

    And yes, I know to run qmake when I change my pro files...

    And QMAKE_CXXFLAGS does also not work... I tried this before....



  • Well, you had better define "does not work" because it does work in the sense that the specified arguments are passed to the compiler through the generated Makefiles.
    @
    Y:\tt>type tt.pro
    TEMPLATE = app
    TARGET = tt
    INCLUDEPATH += .

    Input

    SOURCES += main.cpp

    QMAKE_CXXFLAGS += -DXYZZY
    QMAKE_CXXFLAGS_RELEASE += -Zi -DPLUGH
    QMAKE_CXXFLAGS_DEBUG += -DPLOVER

    Y:\tt>qmake -v
    QMake version 3.0
    Using Qt version 5.2.1 in C:\Qt\5.2.1\msvc2010\lib
    @
    The debug makefile contains both the QMAKE_CXXFLAGS and QMAKE_CXXFLAGS_DEBUG options:
    @
    Y:\tt>qmake CONFIG+=debug

    Y:\tt>find "XYZZY" Makefile.debug

    ---------- MAKEFILE.DEBUG
    CXXFLAGS = -nologo -Zm200 -Zc:wchar_t -DXYZZY -Zi -MDd -DPLOVER -GR -W3 -w34100 -w34189 -EHsc /Fddebug\tt.pdb $(DEFINES)
    @
    The release makefile contains both the QMAKE_CXXFLAGS and QMAKE_CXXFLAGS_RELEASE options:
    @
    Y:\tt>qmake CONFIG+=release

    Y:\tt>find "XYZZY" Makefile.Release

    ---------- MAKEFILE.RELEASE
    CXXFLAGS = -nologo -Zm200 -Zc:wchar_t -DXYZZY -O2 -MD -Zi -DPLUGH -GR -W3 -w34100 -w34189 -EHsc $(DEFINES)
    @
    and you can see these options make it to the compiler:
    @
    Y:\tt>nmake

    Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
    Copyright (C) Microsoft Corporation. All rights reserved.

        "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\nmake.exe" -f Makefile.Release
    

    Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
    Copyright (C) Microsoft Corporation. All rights reserved.

        cl -c -nologo -Zm200 -Zc:wchar_t -DXYZZY -O2 -MD -Zi -DPLUGH -GR -W3 -w34100 -w34189 -EHsc -DUNICODE -DWIN32 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DNDEBUG -I"." -I"C:\Qt\5.2.1\msvc2010\include" -I"C:\Qt\5.2.1\msvc2010\include\QtGui" -I"C:\Qt\5.2.1\msvc2010\include\QtANGLE" -I"C:\Qt\5.2.1\msvc2010\include\QtCore" -I"release" -I"C:\Qt\5.2.1\msvc2010\mkspecs\win32-msvc2010" -Forelease\ @C:\Users\Admin\AppData\Local\Temp\nmC69A.tmp main.cpp
    

    ...
    @
    Qt Creator really has nothing to do with this, it simply runs qmake on your behalf.



  • Hi, ChrisW67

    shame on me. I have in my project not only Qt 5.2.1, I am test always against Qt 4.8.5 and using also VC 2012.

    I had taken the wrong Kit (Qt 4.8.5)....
    As I had a worse bug (not correctly initialized variable), I use qDebug() to set markers instead debugging. I found the problem after a while and I also detect, that I had used the wrong Kit. With Qt 5.2.1, it works...

    Sorry again and thank you for your help...

    Regards,
    Peter


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.