Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/152.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 启用C++;11使用MinGW或VS2012编译器对Qt的支持_C++_Regex_Qt_C++11 - Fatal编程技术网

C++ 启用C++;11使用MinGW或VS2012编译器对Qt的支持

C++ 启用C++;11使用MinGW或VS2012编译器对Qt的支持,c++,regex,qt,c++11,C++,Regex,Qt,C++11,我刚刚安装了QtSDK,在尝试使用regex函数时遇到了一些问题 编译程序时出现以下错误: #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 opti

我刚刚安装了QtSDK,在尝试使用regex函数时遇到了一些问题

编译程序时出现以下错误:

#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.
我已尝试将其添加到我的项目文件中:

QMAKE_CXXFLAGS += -std=c++0x

但是我还有更多的错误。Blocks regex工作正常,并且也在使用MinGW。
那么如何在QtSDK上使用C++11工具呢?

在.pro文件中,添加行

CONFIG += c++11
照C.R.说的做:

CONFIG += c++11
并且总是在编辑.pro文件之后:

构建->全部清除。 生成->全部重建

我可以证实这种方法是有效的。我在使用初始值设定项列表定义向量时遇到编译问题。在将这一行添加到我的.pro文件后,它起了作用


我之所以发布这篇文章,是因为我不能对其他人的帖子发表评论。

这行不通。我得到了完全相同的错误。PS:我以前清理过项目,并再次运行qmake,但什么都没有。@curiosul:编译器是什么?你们的编译器和Qt SDK的编译器匹配吗?我在Qt论坛上读到过,Qt SDK有问题,而来自kit的mingw很旧。现在我已经安装了VS2012的Qt版本,工作正常。糟糕的是,我已经重新安装了Windows和Qt,现在它工作得很好。
CONFIG += c++11