-1

我刚刚安装了 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.

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

QMAKE_CXXFLAGS += -std=c++0x

QMAKE_CXXFLAGS += -std=gnu++0x

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

4

2 回答 2

7

在 .pro 文件中,添加该行

CONFIG += c++11
于 2013-08-31T13:53:22.577 回答
1

照 CR 说的做:

CONFIG += c++11

并且总是在编辑 .pro 文件之后:

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

我可以确认这种方法有效。在使用初始化列表定义向量时,我在编译时遇到了问题。将此行添加到我的 .pro 文件后,它起作用了。

我发布这个是因为我无法评论其他人的帖子。

于 2013-12-27T07:38:26.993 回答