在将数字转化为字符串时使用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. golang生成c-shared so供c语言或者golang调用到例子

    1.golang生成c-shared类型到so 建立文件夹hello,创建main.go文件,内容如下 package main import "C" func main() {} ...

  2. InstallUtil.exe版本引起安装windows services 服务遇到的问题,System.BadImageFormatException

    原文:把程序安装成windows服务的过程及遇到的问题 做好了定时任务的程序,要把它放在服务器上,作为windows服务运行,也就是说,退出登录,用户注销后程序任然在后台运行. 将exe程序发布为服务 ...

  3. VS2012 调试Web项目 遭遇 HTTP 错误 500.23 - Internal Server Error

    原文:VS2012 调试Web项目 遭遇 HTTP 错误 500.23 - Internal Server Error 在使用vs2012 调试Web站点时 报错 500.23,详细如图 此错误是因为 ...

  4. windows media player 播放视频

    一.新建windows应用程序项目,添加vedioForm窗体 二.在com组件中找到windows media player,添加引用 三.代码如下: public partial class Ve ...

  5. Linux 下 Redis 服务 Shell启动脚本

    # chkconfig: 2345 10 90 # description: Start and Stop redis  PATH=/usr/local/bin:/sbin:/usr/bin:/bin ...

  6. How to setup Assigned Access in Windows 10 (Kiosk Mode) 设置分配的访问权限(Kiosk模式)

    Let’s say you’re building some sort of ingenious mechanical contraption to be displayed in public th ...

  7. QT+OpenCV+OpenGL安装

    Ubuntu 10.04.3 LTS ("fresh" install) OpenCV 2.3.1 Qt SDK version 1.2.0 for Linux/X11 32-bi ...

  8. 适配DirectFB到qt4.8.5(嵌入式Linux)

    适配DirectFB到qt4.8.5 1.编译qt4.8.5 这部在qt官网上其实已经有较详细的说明,了解更多,请点击链接进入. 首先是配置选项,如下是我的配置选项: ./configure \ -p ...

  9. javascript 实现ajax

    AJAX 英文名称 Asynchronous JavaScript and XML即异步的 JavaScript 和 XML AJAX 是与服务器交换数据并更新部分网页一门无刷新技术构建自己的ajax ...

  10. 浅谈js闭包(closure)

    相信很多从事js开发的朋友都或多或少了解一些有关js闭包(closure)的知识. 本篇文章是从小编个人角度,简单地介绍一下有关js闭包(closure)的相关知识.目的是帮助一些对js开发经验不是很 ...