error: ‘to_string’ was not declared in this scope
错误:
error: ‘to_string’ was not declared in this scope
原因:
to_string是C++11引入的新功能,旧版本编译器可能不支持它,所以要给编译器加上“C++11”编译支持
解决方案:
Linux下的GCC编译器:在 g++ 命令行加入编译选项 -std=c++11,例如:
g++ -o test test.cpp -std=c++
CodeBlocks编译器:工具栏打开Settings->Compiler,在这里勾选C++11标准即可。(参考链接)

Dev C++ 编译器:在菜单栏点开Tools -> Compile Options,加上圈住的编译指令即可让编译器支持c++11的标准。(参考链接)

error: ‘to_string’ was not declared in this scope的更多相关文章
- error: 'LOGE' was not declared in this scope
移植了下HAL,发现编译出现如下错误 error: 'LOGE' was not declared in this scope 比较了一下android4.1的 system/core/include ...
- 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 ...
- 【QT】error: 'SIGNAL' was not declared in this scope
error: 'SIGNAL' was not declared in this scope 未在此范围内声明. connect(ui->Btnshowhello,SIGNAL(clicked ...
- [Error] 'exit' was not declared in this scope的解决方法
新手刚开始用Linux和c++写程序,可能会出现下面的错误 error: ‘exit’ was not declared in this scope 解决方法是 添加 #include <cst ...
- 解决Cygwin编译cocos2dx 遇到的 error: 'UINT64_C' was not declared in this scope 问题
环境工具:Win10.VS2013.cocos2d-x-2.2.6.Cygwin.ADT 问题来源:写了一个小游戏,VS2013上运行成功,就尝试着打包apk,项目导入到ADT里面,添加了cocos2 ...
- 编译是报error: 'EVNET_COME_TO_FOREGROUND' was not declared in this scope
Compile++ thumb : game_shared <= main.cpp jni/hellocpp/main.cpp: In function 'void Java_org_coco ...
- 调用ffmpeg库编译时出现common.h:175:47: error: 'UINT64_C' was not declared in this scope
解决办法 出现错误:jni/ffmpeg/libavutil/common.h:175:47: error: 'UINT64_C' was not declared in this scope 解决: ...
- In function 'int av_clipl_int32_c(int64_t)': error: 'UINT64_C' was not declared in this scope
cygwin下使用ndk编译jni时遇到的错误: /ffmpeg/include/libavutil/common.h: In function 'int av_clipl_int32_c(int64 ...
- 程设刷题 | 编译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> ...
随机推荐
- vue 自定义动态弹框
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 【Java_Spring】java解析多层嵌套json字符串
java解析多层嵌套json字符串
- url地址形式的传参格式拼接
例子一: var gid=pid=pizi=sn=newsn=sn_price=city_id=123; var params = 'gid=' +123; params += '&pid=' ...
- 【104】Maven3.5.0结合eclipse使用,提示Lambda expressions are allowed only at source level 1.8 or above错误的解决方法
错误重现 我的机器上安装了 maven 3.5.0,在 eclipse 中创建 maven 项目.pom.xml配置如下: <project xmlns="http://maven.a ...
- [BZOJ1010]玩具装箱toy(斜率优化)
Description P教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京.他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中.P教授有编号为1... ...
- UVA_10653 公主与王子 #刘汝佳DP题刷完计划
题意如蓝书66页例题27所示. 这个问题描述了一个LCS的特殊情况——单个字符串内所有元素各不相同. 题目要求输入两个数字串,A,B,要求求出最长公共字串.且数字上限是256*256. 做法:数组A表 ...
- 最近使用Nginx的一点新得
1.基本的负载配置 Nginx最简单的配置模块如下 upstream name{ server ip:port; server ip:port; } server { listen 80; serve ...
- 2 Model层 -定义模型
1 ORM简介 MVC框架中包括一个重要的部分,就是ORM,它实现了数据模型与数据库的解耦,即数据模型的设计不需要依赖于特定的数据库,通过简单的配置就可以轻松更换数据库 ORM是“对象-关系-映射” ...
- jquery 如何实现回顶部 带滑动效果
$("#returnTop").click(function () { var speed=200;//滑动的速度 $('body,html').animate({ scrollT ...
- java流、文件以及IO
读写文件 一个流被定义为一个数据序列.输入流用于从源读取数据,输出流用于向目标写数据. 输入流和输出流的类层次图. FileInputStream FileInputStream用于从文件中读取数据, ...