Home > Backend Development > C++ > body text

Why are std::stoi, std::stoul, and related functions not recognized in MinGW 4.6.1?

Linda Hamilton
Release: 2024-10-29 20:10:30
Original
180 people have browsed it

Why are std::stoi, std::stoul, and related functions not recognized in MinGW 4.6.1?

std::stoi Issue in MinGW 4.6.1

Upon attempting to compile a program utilizing std::stoi, std::stoul, and related functions with MinGW 4.6.1, an error is encountered indicating that these functions are not recognized as members of std. This issue arises due to the non-standard declaration of vswprintf on Windows platforms.

The GNU Standard Library sets the macro _GLIBCXX_HAVE_BROKEN_VSWPRINTF, which disables the conversion functions used. This macro effectively disables the conversion functions used. For an in-depth understanding of the issue, refer to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37522.

To address this issue, users may modify the header files distributed with MinGW. This can involve removing the !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF) macro from line 2754 of .../lib/gcc/mingw32/4.6.1/include/c /bits/basic_string.h. Additionally, add the macro back around lines 2905 to 2965, which reference std::vswprintf. This modification will enable the availability of conversion functions, excluding std::to_wstring functions.

The above is the detailed content of Why are std::stoi, std::stoul, and related functions not recognized in MinGW 4.6.1?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!