我有一个项目我已经工作了一段时间,总是在调试中。今天我尝试构建一个版本,它无法编译并抛出一些非常奇怪的错误。虽然调试编译没有任何警告,但发布抛出:
/usr/include/c++/4.7/bits/c++0x_warning.h:32:2: 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.
两个 CMake 版本都启用了 c++11:
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=gnu++11 -Wall -g")
set(CMAKE_CSS_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=gnu++11 -Wall")
我如何跟踪是什么导致了 Release 中的编译错误?
编辑我正在使用 Cmake 2.8 并尝试使用 gcc-4.6.3 和 4.7.2 进行编译,并且都有同样的问题。
EDIT#2使用 -std=c++0x 而不是 c++11 时问题仍然存在。
EDIT#3降级到 g++4.6 并没有太大帮助。错误现在简单地更改为:
/usr/include/c++/4.6/bits/c++0x_warning.h:32:2:etc...
EDIT#4我已经删除<thread>
了首先引起问题的。然后是<mutex>
和<atomic>
。现在它是任何使用std::shared_ptr<Blah>
. 在我看来,好像 Release 根本不想用 C++11 编译。这是故意的吗?