Search code examples
c++qtwarningsmingwpragma

Qt 4.6 + MinGW: suppress warnings for generated code


We are using Axis2 (WSDL2C) to generate *.c/*.h files from WSDLs in order to be able to call webservices with Qt 4.6. But the generated code creates a massive amount of warnings (3 services -> >1k warnings), mostly about uninitialized or unused variables. How can we suppress these warnings properly?

I know I can wrap headers in #pragma to suppress warnings from 3rd party libs, but how to deal with generated code where the warnings come from the implementation?


Solution

  • Add this line to your Qt .pro or .pri file:

    QMAKE_CFLAGS += -Wno-unused
    

    It turns off unused warning.