爲什麼不能在gcc上編譯?在libstdC++中使用std :: to_wstring?
#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: In function ‘int main()’:
prog.cpp:6:26: error: ‘to_wstring’ is not a member of ‘std’
你使用的是什麼版本的GCC和libstdC++? –
你正在使用'-std = C++ 11'並定義'__GXX_EXPERIMENTAL_CXX0X__'? – antonijn
@Antonijn,你不應該定義'__GCC_EXPERIMENTAL_CXX0X__',把它留給編譯器,不要這樣做。永遠不要這樣做。 –