在将数字转化为字符串时使用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. ubuntu 16.04 安装 openjdk 1.7

    由于编译Android源码需要openjdk1.7.X版本.ubuntu 16.04自带openjdk为1.8.X版本. sudo apt-get install openjdk-7-jre 或者su ...

  2. 基于Spring开发

    1. XML Schema 1.1 最简单的标签 一个最简单的标签,形式如: <bf:head-routing key="1" value="1" to= ...

  3. redis的简介和使用

    简介 redis(Remote Dictionary Server)是一种Nosql技术,它是一个开源的高级kv存储和数据结构存储系统,它经常被拿来和Memcached相比较,但是Memcached不 ...

  4. UWP 发送短信公用倒计时按钮

    1.要求:      发送验证码按钮,点击后,会倒计时60s,之后才能再次点击.不同界面的多个验证码按钮共享这个倒计时时间. 2.操作步骤       1) 从登录界面-->忘记密码输入手机号- ...

  5. [Leetcode]Single Number && Single Number II

    Given an array of integers, every element appears twice except for one. Find that single one. 非常简单的一 ...

  6. TopFreeTheme精选免费模板【20130626】

    有一段时间没有发布的模板了,相信很多喜欢新模板的朋友有点焦急了!还好,今天我今天整理了13个最新的模板,主要是WordPress的,另外3个是关于Joomla的模板,他们分别是游戏主题.俱乐部主题以及 ...

  7. 第四章 .net core做一个简单的登录

    项目目标部署环境:CentOS 7+ 项目技术点:.netcore2.0 + Autofac +webAPI + NHibernate5.1 + mysql5.6 + nginx 开源地址:https ...

  8. 手动实现 SpringMVC

    前几章我们已经分析了 Spring 的源码并且手动实现了一个 IOC/DI 容器. 这章我们在自己实现的 Spring 框架的基础上实现一个 SpringMVC 框架. 我们自己实现的 Spring ...

  9. (Demo分享)利用JavaScript(JS)实现一个九宫格拖拽功能

    利用JavaScript(JS)实现一个九宫格拖拽功能   Demo实现了对任意方格进行拖拽,可以交换位置,其中Demo-1利用了勾股定理判断距离! Demo-1整体思路: 1.首先div实现自由移动 ...

  10. laravel-admin(自定义表单与验证)

    场景: 很多时候,由于我们业务场景比较特殊,需要自定义表单,然后框架给我提供了对应表单组建! 案列:以创建一个字段为列 1.在控制器对应的方法中调用表单组建创建表单 public function c ...