Qt World Summit: Register Today!

Using compiler switches with Qt Qmake

  • Hi All,

    I've developed a simple currency converter application in Qt. For conversion multipliers I've declared a two dimensional float array in my header and I had a statement like one below in my cpp file,
    @currency[3][3] = {{2,2,2},{2,2,2},{2,2,2}};@
    But, when I build it, I get the following warning/error.
    @../mainwindow.cpp:15: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
    ../mainwindow.cpp:15: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘float’ in assignment@
    As I see the debug info, I figured out that I can set the -std switch for gcc, to override this issue. But, I don't think, I could make changes in the makefile created each time I build with qmake. Is there any solution for this?

    Thank You

  • Are you using qmake directly or through an IDE?
    If you are using qt creator you may change the settings under projects.

  • Add to your .pro file:

    QMAKE_CXXFLAGS += -std=c++0x
    QMAKE_CFLAGS += -std=c++0x

    Maybe you need to set the xxx_DEBUG flags too. See the qmake manual/variable description for details.

  • Volker, Koahnig,

    It worked.

    Thank You

Log in to reply