以下簡單的程序不能在cygwin的用gccCygwin的:克++ 5.2: 'to_string' 不是
#include <string>
#include <iostream>
int main()
{
std::cout << std::to_string(4) << std::endl;
return 0;
}
命令行編譯 'STD' 的成員:
$ 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編譯此代碼或我需要編寫一個解決方法?
您可能需要使用'-std = C++ 11'代替'-std = C++ 0x' – NathanOliver
@NathanOliver相同的結果。 – Alex
您是否檢查過哪個''標頭被使用? –