如何使用最近的mingw将Qmake设置为C 14
How to set qmake to C++14 with recent MinGW?
我知道有很多重复。
这是我的test.pro:
CONFIG += c++14
SOURCES += main.cpp
和我的main.cpp:
int main(){}
根据许多重复,这应该给我C 14。但是,当我使用 QT创建者4.2.0 QT 5.8.0-1 和 Mingw GCC 5.3.0-1 安装时通过维护工具,我得到
g -c -c -pipe -pipe -fno -keep -inline -dllex -dllexport -g -STD = GNU 1y -frtti -wall -wall -wall -Wall -wextra -fexpections -mthreads -mthreads -dunicode -dunicode -dunicode -dqt_qml_debug -dqml_debug -dq_debug -dq_guii _dqt_guii _dqt_ge_guii cor-dqt_needs_qmain -i .. test -i。-ic: qt 5.8 mingw53_32 include -ic: qt 5.8 mingw53_32 include qtgui -ic -ic: qt qt qt 5.8 5.8 mingw53_32-idebug -ic: qt 5.8 mingw53_32 mkspecs win32 -g -o -o debug main.o .. test test main.cpp
这不是我期望的-std=c++14
。
我尝试了其他问题的各种技巧,例如
QMAKE_CXXFLAGS_CXX14 = -std=c++14
CONFIG += c++14
QMAKE_CXXFLAGS += -std=c++14
SOURCES += main.cpp
导致
g -c -pipe -pipe -fno -keep -inline -dllexport -STD = C 14 -g -STD = GNU 1y -frtti -frtti -wall-wextra -fexceptions -mthreads -dunicode -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I .. test -i。-ic: qt 5.8 mingw53_32 include -ic: qt 5.8 mingw53_32 include qtgui -ic -ic: qt qt qt 5.8 5.8 mingw53_32-idebug -ic: qt 5.8 mingw53_32 mkspecs win32 -g -o -o debug main.o .. test test main.cpp
第二个选项覆盖第一个,这意味着它仍然在gnu++1y
-mode中或仅在
QMAKE_CXXFLAGS += -std=c++14
SOURCES += main.cpp
也导致
g -c -c -pipe -pipe -fno -keep -inline -dllexport -STD = C 14 -g -STD = GNU 11 -frtti -frtti -wall-wextra -fexceptions -mthreads -dunicode -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I .. test -i。-ic: qt 5.8 mingw53_32 include -ic: qt 5.8 mingw53_32 include qtgui -ic -ic: qt qt qt 5.8 5.8 mingw53_32-idebug -ic: qt 5.8 mingw53_32 mkspecs win32 -g -o -o debug main.o .. test test main.cpp
我删除了构建目录和test.pro.user文件以从头开始强制构建,没有任何东西给我C 14。
我如何告诉qmake使用C 14?
您使用的QT版本并未明确支持所使用的编译器。您可以做以下一个:
-
set
QMAKE_CXXFLAGS_CXX14
和QMAKE_CXXFLAGS_GNUCXX14
在您的项目中:win32-g++ { QMAKE_CXXFLAGS_CXX14 = -std=c++14 QMAKE_CXXFLAGS_GNUCXX14 = -std=c++14 }
-
在QT安装文件夹中的
mkspecs/win32-g++/qmake.conf
中编辑这两个变量的默认值。 -
添加从
win32-g++
复制的新mkspec
,定位编译器,并使用它构建QT。然后,使用QT的所有项目都将正确地行事W.R.T.C 14支持。
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 在C++/Linux中设置单调时钟的一些技巧
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 嵌套在类中时无法设置成员数据
- 需要帮助设置在C++中使用的Potrace
- 如何在自删除后将对象设置为nullptr
- 将指针设置为"nullptr"并不能防止双重删除?
- 如何在Ubuntu中使用cmake设置qt4
- ld:bind_at_load和-bitcode_bundle(Xcode设置ENABLE_bitcode=YES)不能
- 如何在boost beast http请求中设置http头
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- 如何将这个C++哈希表转换为动态扩展和收缩,而不是使用硬设置的最大值
- 为什么文件名被设置为一个点,而不是在读取矢量中的文件名时
- 如何在24位SDL_Surface上设置像素的颜色
- std::设置自定义比较器
- 为没有qmake/VS的Qt Windows应用程序设置.exe图标
- 如何使用最近的mingw将Qmake设置为C 14
- 是否可以在 qmake .pro 文件中设置视觉工作室项目属性
- 是否可以全局设置qmake调试?
- 如何在qmake中设置预编译头文件夹的名称