每次我使用C++11提供的一个新类(如rono.h)并与GCC一起编译它时,它都警告我,C++11函数仍然是实验性的,必须使用特殊标志才能使用。
截至2014年底,在撰写这篇文章时,GCC为何在至少3.5年后仍将C++11标记为“试验性”,经过这么多年,C++11提供给我们的一些功能仍未实现?
如果是这样的话,为什么?
代码:
#include <chrono>
#include <thread>
int main()
{
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
return 0;
}编译器行:g++ Source.cpp -o test.exe
GCC版本: g++ (x86_64-posix-seh-rev0,由MinGW-W64项目建造) 4.9.2版权(C) 2014年自由软件基金会公司。
GCC吐出:C:/Program Files/mingw-w64/x86_64-4.9.2-posix-seh-rt_v3-rev0/mingw64/x86_64-w64- mingw32/include/c++/bits/c++0x_warning.h:32:2: error: #error This file requires G compiler and library support for the ISO C++ 2011 standard. This support is curr ently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 comp iler options.
发布于 2014-11-20 17:19:33
一旦我加进去。编译器选项的'-std=c++11‘我不再收到错误/警告消息,但我已经知道了。我不明白它为什么不加一句就给我一个警告。GCC现在的性病不是已经是C++11了吗?为甚麽仍然不是这样呢?
在那里的软件和构建系统使用缺省值,并期望它们保持相当稳定。GCC并不是每次有新标准或新功能时都会简单地更新默认设置。
如果您想要特定版本的标准,那么您应该显式地指定它。
https://stackoverflow.com/questions/27043477
复制相似问题