Qt 5.6: QMAKE and CONFIG = C++11 - is it safe to remove this?



  • After upgrading to Qt 5.6 I was annoyed to learn that CONFIG had C++11 flag set by default. Not only it overrode my *g++*:QMAKE_CXXFLAGS += -std=c++1y, but also used the gnu version of the standard, which is not what I want.

    So, my question is: does this config value change anything else other than the -std= flag? If yes, how do I get my desired behaviour (compilation in standard-compliant mode with a recent standard, like 14 or 17)?


  • Moderators

    Hi!
    It is not clear to me: do you mean Qt 5.6 is built with C++11 support or where is this flag set by default?
    Did you try CONFIG += c++14?


  • Moderators

    @krzaq said:

    does this config value change anything else other than the -std= flag?

    No, feel free to remove or replace it.



  • @jsulm Yes I tried C++14 config, it results in -std=gnu++1y being added - not what I want.

    And I don't know whether Qt is built with C++11 or not. After switching to the 5.6 kit my project stopped building because -std=gnu++0x overrode my flag for c++1y.



  • @krzaq I'm surprised anything changed at all with the c++14 flag. Are you using 5.6.0-rc ? In my caseCONFIG += c++11 c++14 doesn't seem to do anything at all when compiling to Android. I'm using 5.6.0-rc and with CONFIG += c++11 c++14 I'm just getting -std=c++11.

    With Qt 5.5.1 CONFIG += c++11 c++14 I get -std=c++1y added to the mix and I can use relevant functionality (std::make_unique).


Log in to reply
 

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