Cygwin:g ++ 5.2:'to_string'不是'std'的成员, [英] Cygwin: g++ 5.2: ‘to_string’ is not a member of ‘std’

查看:372
本文介绍了Cygwin:g ++ 5.2:'to_string'不是'std'的成员,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下简单程序无法使用gcc

The following simple program can't be compiled in cygwin with gcc

#include <string>
#include <iostream>

int main()
{
  std::cout << std::to_string(4) << std::endl;
  return 0;
}

命令行:

$ g++ -std=c++0x to_string.cc

错误:

to_string.cc: In function ‘int main()’:
to_string.cc:6:16: error: ‘to_string’ is not a member of ‘std’
   std::cout << std::to_string(4) << std::endl;

G ++版本:

$ g++ --version
g++ (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

同样的代码可以在Ubuntu中编译。

The same code can be compiled in Ubuntu.

有可能编译这个代码与cygwin或我需要写一个解决方法?

Is it possible at all compile this code with cygwin or I need to write a workaround?

推荐答案

和g ++在这里

引用 Mike F :默认值可能最重要的区别是,自动。

To quote Mike F: "The probably most important difference in their defaults is which libraries they link against automatically."

g ++和gcc之间有什么区别?

这篇关于Cygwin:g ++ 5.2:'to_string'不是'std'的成员,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆