Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用std::与libstdc++一起使用?_C++_Gcc_C++11_Libstdc++ - Fatal编程技术网

使用std::与libstdc++一起使用?

使用std::与libstdc++一起使用?,c++,gcc,c++11,libstdc++,C++,Gcc,C++11,Libstdc++,为什么它不能在gcc上编译 #include <iostream> #include <string> int main() { double f = 23.43; std::wstring f_str = std::to_wstring(f); std::wcout << f_str << std::endl; return 0; } 错误: prog.cpp:在函数“int main”中:

为什么它不能在gcc上编译

#include <iostream>
#include <string>
 
int main() {
 
    double f = 23.43;    
    std::wstring f_str = std::to_wstring(f);
    std::wcout << f_str << std::endl;
 
    return 0;
}
错误:

prog.cpp:在函数“int main”中:

程序cpp:6:26:错误:“to_wstring”不是“std”的成员

是在C++11中添加的。您在ideone上的答案中的链接未使用C++11编译器:

语言:C++ GCC-4.7.2

它编译得很好::

语言:C++0x gcc-4.7.2

是在C++11中添加的。您在ideone上的答案中的链接未使用C++11编译器:

语言:C++ GCC-4.7.2

它编译得很好::

语言:C++0x gcc-4.7.2


< C++ C++ C++ C++程序>如果你选择C++在IDEONE而不是C++,因为它是C++ 11的特征。

你的程序编译如果你选择C++在IDEONE而不是C++,因为它是C++ 11的特征。< /P>你使用的是什么版本的GCC和LIbSTDC++?你是使用-STD= C++ 11,定义了Antonijn的GXXX实验?您不应该定义uuugcc_cx0x_uuuuuuuuuuuucx0x_uuuuuuuuuuuuuuuuuuuuucx0x_uuuuuuuuuuuuuuuuuuuuuuuuu。永远不要这样做。你使用的是什么版本的GCC和libstdc++呢?你使用的是-std=c++11并定义了uuu-GXX\u-experiative\u-cx0x\uuu吗?@Antonijn,你不应该定义uu-GCC\u-experiative\u-cx0x\uu,让编译器来定义,不要这样做。永远不要那样做。