1. 程式人生 > >Ubuntu 編譯出現 ISO C++ 2011 不支持的解決辦法

Ubuntu 編譯出現 ISO C++ 2011 不支持的解決辦法

.cpp lib 出現 res ++ g++ sta 其中 語法

問題

在編譯時出現如下error:

error:This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

原因

編譯的時候未開啟 ISO C++ 2011 的支持選項,無法支持 ISO C++ 11 的有關語法

解決辦法

修改MakeFile,在其中的

g++ -o test test.cpp

加上一行 -std=c++11,變成

g++ -std=c++11 -o test test.cpp

即可編譯成功

Ubuntu 編譯出現 ISO C++ 2011 不支持的解決辦法