Cygwin:g++5.2:“to_string”不是“std”的成员
Cygwin: g++ 5.2: ‘to_string’ is not a member of ‘std’
以下简单程序无法在带有gcc 的cygwin中编译
#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中编译。
有没有可能用cygwin编译这些代码,或者我需要写一个变通方法?
您在这里混合了gcc和g++
引用Mike F
的话:"它们默认值中最重要的区别可能是它们自动链接到哪些库。"
g++和gcc之间有什么区别?
相关文章:
- 为什么我应该在异常处理中使用std::cerr而不是std::cout
- std::to_string - 'to_string' 不是 'std' 的成员 - Visual Studio Code 1.42.0
- FreeFileSync C++错误:'byte'不是 'std' 的成员
- 使用 std::addressof(std::cout) 而不是 &std::cout 是否有任何风险?
- 隐式转换为比较函数对象(函子)用于 std::sort 而不是 std::map?
- 无法从好友功能访问类的私有成员?"ostream"不是"std"的成员?
- 线程不是 std c++ 的成员
- 为什么会出现错误:size不是std的成员
- 读取互斥对象范围之外的volatile变量,而不是std::atomic
- 不是 'std::vector<_Ty> 的成员
- C++ GCC 错误:"sqrtl"不是"std"的成员
- _Pairib":不是"std::map,std::分配器"的成员>>
- 如何将 std::list of 派生类而不是 std::list of parent class 传递给函数
- 'make_unique'不是'std'的成员
- "random_shuffle":不是"std"错误的成员
- 为什么错误:"locate_zone"不是"std::chrono"的成员
- 为什么 std::when_any 使用 std::tuple 而不是 std::vector 作为其结果类型?
- "<某些系统标头>:错误:"<在此处插入函数>"在移动源文件后不是"std"的成员
- Clang希望我写:: STD :: Declval而不是STD :: Declval
- 哈希输出为 BYTE 而不是 std::string