事象発生日:2017-08-03
記事公開日:-
アクセス数:5136
Microsoft Windows 10 Home (64bit)
mingw-get version 0.6.2-beta-20131004-1 Copyright (C) 2009-2013, MinGW.org Project
g++ (GCC) 5.3.0
MinGWのg++でto_string
関数を使用すると,
1 | error: 'to_string' is not a member of 'std' |
と怒られる.
[1]に同様の問題に対する以下のような回答がのっている.
This is a known bug under MinGW. Relevant Bugzilla. In the comments section you can get a patch to make it work with MinGW.
This issue has been fixed in MinGW-w64 distros higher than GCC 4.8.0 provided by the MinGW-w64 project. Despite the name, the project provides toolchains for 32-bit along with 64-bit. The Nuwen MinGW distro also solves this issue.
どうやら,MinGWのバグのようだ.
MinGWの開発自体が今どうなってるのか不明(長いことMinGWは更新されていない)なことと,MinGW-w64だと直っているということより,そろそろMinGW-w64に乗り換えてもいいかもしれないなぁ.
代替策として,以下のような関数を定義して代用している.
1 | template < typename T> |
2 | string ToString( const T& input) { |
3 | ostringstream oss; |
4 | oss << input; |
5 | return oss.str(); |
6 | } |
[1] | stackoverflow. to_string is not a member of std, says g++ (mingw). Retrieved August 3, 2017, from https://stackoverflow.com/questions/12975341/to-string-is-not-a-member-of-std-says-g-mingw |
名前
Email (※公開されることはありません)
コメント