How to set qmake to C++14 with recent MinGW?

前端 未结 1 711
挽巷
挽巷 2021-01-15 16:53

I know there are many duplicates.

This is my Test.pro:

CONFIG += c++14
SOURCES += main.cpp

and my main.cpp:

int mai         


        
相关标签:
1条回答
  • 2021-01-15 17:41

    The version of Qt that you're using doesn't explicitly support the compiler you're using. You can do either one of the following:

    1. Set both QMAKE_CXXFLAGS_CXX14 and QMAKE_CXXFLAGS_GNUCXX14 in your project:

      win32-g++ {
         QMAKE_CXXFLAGS_CXX14 = -std=c++14
         QMAKE_CXXFLAGS_GNUCXX14 = -std=c++14
      }
      
    2. Edit the default values of those two variables as above, in mkspecs/win32-g++/qmake.conf within your Qt installation folder.

    3. Add a new mkspec copied from win32-g++, targeting your compiler, and build your Qt using it. All the project that use that Qt will then behave correctly w.r.t. C++14 support.

    0 讨论(0)
提交回复
热议问题