Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Disable MSVC compiler warnings



  • I use QtCreator with MSVC 2013 and cannot eliminate this damned compiler warnings. I tested:

    QMAKE_CXXFLAGS += -wd4189
    QMAKE_CXXFLAGS_WARN_OFF += -wd4189
    QMAKE_CFLAGS_WARN_OFF += -wd4189
    QMAKE_CXXFLAGS_DEBUG+= -wd4189
    QMAKE_CFLAGS_RELEASE += -wd4189
    QMAKE_CFLAGS_DEBUG+= -wd4189
    QMAKE_CFLAGS_RELEASE += -wd4189

    Nothing helps ! Here is the line generated from qmake:

    cl -c -nologo -Zc:wchar_t -FS -wd4189 -Zi -MDd -wd4189 -GR -W3 -w34100 -w34189 -w44996 -EHsc



  • Hi,
    you've probably already seen this posting on stackoverflow ( http://stackoverflow.com/questions/20402722/why-disable-specific-warning-not-working-in-visual-studio ) but perhaps it helps. So maybe you want to try QMAKE_CXXFLAGS_WARN_ON -= -wd4189. I think it would be a bit weird if it worked but who knows ^_^



  • Hi @Wieland ,
    Wow :-) this is the solution.
    I think the problem was the order of the switches in the command line created from QMake. It puts the QMAKE_CXXFLAGS_WARN_ON at the end of it, so you can overwrite the previous warning settings.

    Thank you very much.


Log in to reply