Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to prevent MinGW Qt 5.9 kit from adding -std=gnu++11/14/1z to compile flags?
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 3.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • krzaqK Offline
    krzaqK Offline
    krzaq
    wrote on last edited by
    #1

    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.

    E 1 Reply Last reply
    0
    • krzaqK krzaq

      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.

      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      @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.?

      krzaqK 1 Reply Last reply
      0
      • E Eeli K

        @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.?

        krzaqK Offline
        krzaqK Offline
        krzaq
        wrote on last edited by krzaq
        #3

        @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
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          krzaqK 1 Reply Last reply
          0
          • SGaistS SGaist

            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.

            krzaqK Offline
            krzaqK Offline
            krzaq
            wrote on last edited by
            #5

            @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>.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt
            • Unsolved