How to prevent MinGW Qt 5.9 kit from adding -std=gnu++11/14/1z to compile flags?



  • In the previous versions (up to 5.8) all I had to do was add the following to the .pro file:

    CONFIG -= c++11
    CONFIG -= c++14
    

    Then, I'd be free to add QMAKE_CXXFLAGS += -std=c++1z or anything I'd want. Unfortunately, this doesn't seem to be the case in the 5.9 kit.

    I created a small testcase: https://github.com/KrzaQ/59test It compiles on mingw kits 5.6 through 5.8 (and I suppose it would compile on some of the older ones as well), but it fails on 5.9, because the following command is issued by make:

    mingw32-make[1]: Entering directory '[...]/build-59test-Desktop_Qt_5_9_0_MinGW_32bit-Debug'
    g++ -c -fno-keep-inline-dllexport -pipe -std=c++14 -g -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\59test -I. -IC:\pro\Qt\5.9\mingw53_32\include -IC:\pro\Qt\5.9\mingw53_32\include\QtCore -Idebug -IC:\pro\Qt\5.9\mingw53_32\mkspecs\win32-g++  -o debug\main.o ..\59test\main.cpp
    

    Specifically, this part:

    -std=c++14 -g -std=gnu++11
    

    I don't know why -std=gnu++11 is being added, overriding my wishes. I tried looking around for the mkspec, but I found nothing obvious to me.

    Any help would be appreciated.



  • @krzaq I don't know if this helps, but gnu++xx is different than ++xx - gnu++xx adds gnu extensions. Have you tried

    CONFIG -= gnu++11
    

    etc.?



  • @Eeli-K I don't think this is directly connected (i.e. CONFIG += c++14 works on MSVC, which has different naming scheme entirely).

    Nevertheless, I have just tried the following, but it didn't fix my problem:

    CONFIG -= c++11
    CONFIG -= c++14
    CONFIG -= gnu++11
    CONFIG -= gnu++14
    

  • Lifetime Qt Champion

    Hi,

    You have to modify the mkspec to fit your need.

    As for MSVC, there's no setting of any standard, the compiler always uses the latest that was implemented by Microsoft.



  • @SGaist That's not an acceptable solution. Modifying the installation on every machine used to build/develop the project because there's a bug in the new Qt is ridiculous.

    Btw: MSVC does, in fact, have a standard switch since the latest version (or maybe one back): /std:latest. Without it you can't have i.e. <string_view>.


Log in to reply
 

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