【发布时间】:2016-03-28 20:15:06
【问题描述】:
我有一个在 linux 上开发的 Qt 项目,但现在我需要在 windows 上编译。我在迁移过程中遇到了一些问题。
我得到的第一个错误是:
C:\Qt\Qt5.5.1\Tools\mingw492_32\i686-w64-mingw32\include\c++\bits\c++0x_warning.h:32: error:
#error This file requires compiler and library support for the ISO C++ 2011 standard.
This support is currently experimental, and must be enabled with the
-std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
这就是我将其放入项目的 .pro 中的方式
QMAKE_CXXFLAGS += -std=c++11
我也试试
CONFIG += c++11
但问题持续存在。
为了提供更多信息,我正在使用 Qt Creator 安装的 MinGW 编译器,并且我的 Headers 和 Sources 的扩展名是:.H 和 .C(以防万一这与问题有关, 因为我看到 Qt 总是使用 .cpp)
问题的原因可能是什么?如果有不清楚的地方或需要更多信息,请告诉我。
【问题讨论】:
-
mingw 使用的是哪个版本的 gcc?在 gcc 4.6 中,右边的标志仍然被称为 c++0x。
-
此问题已通过将 .C 文件的扩展名更改为 .cc 得到解决。不过还是谢谢。
-
CONFIG += c++11应该可以工作。进行更改后您是否运行了qmake? -
我做到了,每次我更改 .pro 时,我都会清理运行 qmake 并构建项目。但就像我说的,这个问题已经解决,感谢您的贡献。