需要在 Codeblocks 中启用 C++11

Need to enable C++11 in Codeblocks

我需要在 Codeblocks 16 中启用 C++11。

几个教程解释说,所有需要做的就是 select "Have g++ follow the C++11 ISO C++ language standard -std=c++11 option in " 设置 > 编译器... > 编译器设置 > 编译器标志",但是我的编译器中没有出现这样的选项标志:

其他人建议只将 -std=c++11 粘贴到 "Other compiler options" 中。然而,这不允许我构建我的代码并在 "Build Messages" 栏中显示:

我正在使用 Codeblocks 16,在 Windows 7 上使用 GNU GCC 编译器。

你总是可以 select -std=c++0x 选项,但另一个解决方案是安装更新的 mingw 版本,因为问题显然是编译器,而不是 Code::Blocks

这就是 Code::Blocks 16.1 和最新包含的 GCC 版本 (TDM-GCC 4.9.2) 的样子。

您可以使用以下命令查看您的 GCC 版本

gcc --version

gcc.exe 位于 ./CodeBlocks/MinGW/bin

从 CodeBlock 的网站下载时,确保下载 codeblocks-16.01mingw-setup.exe

问题出在你的编译器上,你可以下载最新的MinGWhere

下载后,您应该可以通过编译器标志select C++11 标准。

goto settings-> compiler ->In GNU GCC mode,-> Compiler settings-> Compiler flags -> 勾选"Having the g++ follow c++ 11 ISO C++ language standard.."

就是这样 Check this helpful Youtube link