我試圖將我的C++編譯器更新到C++ 11。 我已經搜索了一下,我得出結論,我必須使用國旗-std=c++0x
或-std=gnu++0x
,但我不知道很多關於標誌的事情。誰能幫我? (我使用Ubuntu 12.04。)用g ++編譯C++ 11
這裏是我從編譯器得到的錯誤,當我嘗試使用這是在包括C++ 11(即陣列)庫:
#include <array>
#include <iostream>
int main()
{
std::array<int, 3> arr = {2, 3, 5};
...
}
This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
這取決於你使用的建設什麼樣的編譯程序。 Makefile文件?蝕?還有別的嗎? – dutt 2012-04-28 12:54:46
在最新版本中,您可能不得不使用'-std = C++ 11'。不過,也許兩者都是允許的。 – 2012-04-28 12:56:04
這忽略了很多上下文。顯示你試過的完整命令(甚至可能是你試圖編譯的示例代碼),以及實際上失敗的代碼。 – KillianDS 2012-04-28 12:56:44