使用MinGW或VS2012编译器在Qt上启用C++ 11支持

caf*_*ine -1 c++ regex qt c++11

我刚刚安装了QtSDK,我有一些问题,我正在尝试使用正则表达式函数.

编译程序时出现此错误:

#error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This supports currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
Run Code Online (Sandbox Code Playgroud)

我试图在我的项目文件中添加它:

QMAKE_CXXFLAGS += -std=c++0x
Run Code Online (Sandbox Code Playgroud)

QMAKE_CXXFLAGS += -std=gnu++0x
Run Code Online (Sandbox Code Playgroud)

但我得到更多其他错误.在Code :: Blocks正则表达式工作正常,也使用MinGW.那么如何在QtSDK上使用C++ 11工具呢?

Siy*_*Ren 7

在.pro文件中,添加该行

CONFIG += c++11
Run Code Online (Sandbox Code Playgroud)