Important: Please read the Qt Code of Conduct -

QMAKE_CXXFLAGS overriden ?

  • Hi!

    I'm attempting to add this flag to the compiler so that my project, doesn't spew out hundreds of "ignoring #pragma warning" messages.

    @QMAKE_CXXFLAGS += -Wno-unknown-pragmas@

    Please, refrain from telling me to fix the warnings, since they are in the OpenNI libraries which I am using and do not intend to modify.

    I noticed that qmake correctly sets this flag in my makefile, like this:

    @CXXFLAGS = -m64 -pipe -Wno-unknown-pragmas -g -Wall -W -D_REENTRANT $(DEFINES)@

    The problem is that qmake is setting some other flags AFTER my flag, and probably one of them overrides mine. (probably -Wall?)

    I tested this by just putting my flag at the end of the line:

    @CXXFLAGS = -m64 -pipe -g -Wall -W -D_REENTRANT $(DEFINES) -Wno-unknown-pragmas@

    after running make, the warnings dissapeared as desired!

    Do you know why Qt Creator / qmake / ? is setting this -Wall flag? How can I avoid that this flag is set, or how can I make it so that my flag has higher priority? (i.e, be the last flag on the line)?

    Thanks for your help

  • Interesting situation. I checked this link:
    and googled a little. This will help you:
    QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas

  • Perfect! Thanks!

Log in to reply