如何将模式从 Dev-C++ 中的 c++98 模式更改为支持 C++0x 的模式(基于范围)?

2022-01-16 00:00:00 compiler-construction c++ c++11 dev-c++

我只是在学习如何编写基于范围的 for 循环,但唯一的问题是我的编译器 Orwell Dev-C++ 在其默认模式(即 c++98)下似乎不支持它.如何将此模式更改为另一种支持此功能(以及 C++0x 的其他功能)的模式.谢谢.另外:

I am just learning how to write range based for loops, but the only problem is that my compiler, Orwell Dev-C++ doesn't seem to support it in its default mode (which is c++98). How can I change this mode to another one that supports this feature (and other features of C++0x). Thanks. Also:

这是错误消息:[错误] C++98 模式中不允许基于范围的 for 循环

This was the error message: [Error] range-based-for loops are not allowed in C++98 mode

我运行的是 Windows 8

I run Windows 8

我的 Dev C++ 版本是 5.3.0.3

The version I have of Dev C++ is 5.3.0.3

并且编译器是 TDM-GCC 4.6.1 64 位.

And the compiler is TDM-GCC 4.6.1 64 bit.

谢谢大家

推荐答案

转到工具->编译器选项->编译器"选项卡

选中标记为调用编译器时添加以下命令"的复选框并在文本输入框中添加-std=c++11"或者如果这不起作用-std=C++0x"

Check the checkbox labeled, "Add the following commands when calling the compiler" And add in the text entry box, "-std=c++11" or if that doesn't work "-std=C++0x"

反正应该是这样的,我已经很多年没有安装Dev C++了,所以我不得不在谷歌上看一些截图来记住.

Should be something like that anyway, I haven't had Dev C++ installed for many years, so I had to look at some screenshots on Google to remember.

相关文章