在将数字转化为字符串时使用to_string()竟然出现了'to_string' was not declared in this scope,我头文件用的万能头文件肯定没问题,而这个函数在其他的CB上运行也没有出错。

原因:to_string()方法是在g++11后出现的,所以需要在编译环境中添加g++11的编译环境。

还有一些其他情况,如遍历用到的auto, 也必须在g++11的环境下。所以,若出现程序在别人的机子上没问题,自己的机子上编译出错,就要考虑编译环境是否正确啦!

settings --- compiler --- 在compiler flag中 --- 勾选 have g++ follow the C++ 11 ISO C++ language standard,点击ok就好啦

转载请注明来源~https://www.cnblogs.com/zcl843264327/p/10069736.html

codeblocks出现'to_string' was not declared in this scope 的问题,用g++11编译环境的更多相关文章

  1. codeblocks中报错:'to_string' was not declared in this scope解决方案

    在windows下使用codeblocks(编译器采用MinGW)时,有时会遇到"'to_string' was not declared in this scope"的错误,这里 ...

  2. 程设刷题 | 编译C++文件出现to_string is not a member of std 或者 to_string was not declared in this scope的解决方法

    写在前面 原文链接:Enabling string conversion functions in MinGW C++在将整型.浮点型.长整型等数据类型转换为字符串时,可使用<string> ...

  3. error: ‘to_string’ was not declared in this scope

    错误: error: ‘to_string’ was not declared in this scope 原因: to_string是C++11引入的新功能,旧版本编译器可能不支持它,所以要给编译器 ...

  4. was not declared in this scope

    “was not declared in this scope”是一个错误信息,在编译的时候会遇到.其含义为标识符在其出现的地方是未被定义的. 出现该错误的时候,会同时把未定义的变量名显示出来.比如如 ...

  5. error: 'LOGE' was not declared in this scope

    移植了下HAL,发现编译出现如下错误 error: 'LOGE' was not declared in this scope 比较了一下android4.1的 system/core/include ...

  6. c++ - fcgio.cpp:50: error: 'EOF' was not declared in this scope - Stack Overflow

    c++ - fcgio.cpp:50: error: 'EOF' was not declared in this scope - Stack Overflow fcgio.cpp:50: error ...

  7. 【QT】error: 'SIGNAL' was not declared in this scope

    error: 'SIGNAL' was not declared in this scope  未在此范围内声明. connect(ui->Btnshowhello,SIGNAL(clicked ...

  8. 【error】'isnan' was not declared in this scope

    error问题 'isnan' was not declared in this scope isnan在cmath中被取消宏定义: // These are possible macros impo ...

  9. [Error] 'exit' was not declared in this scope的解决方法

    新手刚开始用Linux和c++写程序,可能会出现下面的错误 error: ‘exit’ was not declared in this scope 解决方法是 添加 #include <cst ...

随机推荐

  1. WPF svg 转 xmal

    原文:WPF svg 转 xmal 今天wpf里面要用矢量图,美工出的是svg格式的,需要将svg格式的转换为xaml 1.第一个尝试是安装Inkscape,这个软件可以直接将svg另存为xaml,但 ...

  2. 元素命名空间中的“MvcBuildViews”无效

    原文:元素命名空间中的"MvcBuildViews"无效 症状描述: VS2010打开项目时提示:"元素 命名空间"http://schemas.microso ...

  3. 职业规划 - DREAM START

    前言 最近面试了好多公司,得出一个结论:做一份详细的计划.一个程序员,不只是写写代码这么简单的事,一种更高的境界则是在代码中.系统的设计中,能找到人生的意义,简单说就是生活的道理.我一直认为:当你在一 ...

  4. Android零基础入门第55节:ImageSwitcher和TextSwitcher使用

    原文:Android零基础入门第55节:ImageSwitcher和TextSwitcher使用 上一期我们了解了ViewAnimator组件和ViewSwitcher组件的使用,你都掌握了吗?本期一 ...

  5. 毕设(一)C#的百度api调用

    这个学期就要毕业了,选了一个无人机地面站软件设计的题目,这几天也开始着手做, 首先做了一个百度地图的调用,这里因为是上位机的开发,所有就不介绍Javascript的 调用方法,核心是用到一个类Http ...

  6. Win32 Application基本框架

    //程序入口 intAPIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdSh ...

  7. 2016最受欢迎国产开源软件评选,2016 年度开源中国新增开源软件排行榜 TOP 100

    http://www.oschina.net/news/80154/2016-cn-open-source-software-top http://www.oschina.net/project/to ...

  8. GTest翻译词汇表

    版本号:v_0.1 词汇表 Assertion: 断言. Bug: 不翻译. Caveat: 警告. Error bound: 误差范围. Exception: 异常. Flag: 标志位. Floa ...

  9. ssh证书登录

    前言 本文基于实际Linux管理工作,实例讲解工作中使用ssh证书登录的实际流程,讲解ssh证书登录的配置原理,基于配置原理,解决实际工作中,windows下使用SecureCRT证书登录的各种问题, ...

  10. excel表格处理

    xlrd模块 ​ 是python中一个第三方的用于读取excle表格的模块,很多企业在没有使用计算机管理前大多使用表格来管理数据,所以导入表格还是非常常用的! exlce结构分析 ​ 一个excle表 ...