gpt4 book ai didi

c++ - Orwell Dev C++ 不适用于 C++11

转载 作者:太空宇宙 更新时间:2023-11-04 15:43:22 25 4
gpt4 key购买 nike

我正在尝试使用 Orwell Dev C++ 中的任何 C++11 功能,但没有成功。我安装了带有 minGW 的版本以及我在编译器选项中设置的任何内容,我只是在这段代码中得到“[Error] 'to_string' was not declared in this scope”:

#include<iostream>
#include<string>
using namespace std;

int main()
{
string test = to_string(5);
}

我尝试设置 -std=gnu++11 和 -std=c++0x,但都没有成功。最奇怪的是,当我单击 to_string 时,它会向我显示重载函数 - long、float、int 等等。因此,它必须以某种方式获得函数的作用——那么它为什么不编译它呢?编译器已正确设置为 MinGW GCC 4.7.2(与安装程序捆绑在一起)。

最佳答案

如果你想在 Dev-C++ 中使用 C++11,你应该执行以下步骤:

  1. 转到“工具”>“编译器选项”
  2. 转到选项卡“设置”>“代码生成”
  3. 将参数语言标准 (-std) 更改为 ISO C++11

关于c++ - Orwell Dev C++ 不适用于 C++11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20432507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com