Thanks all for the help.
Here is an update to my code
<snip>
void setGlobalLocale(const std::string& str) noexcept {
std::string tmp;
tmp = std::setlocale(LC_ALL, str.c_str());
}
</snip>
This also ends with this message:
=======================================================
Output file is bin\Debug\Locale.exe with size 3.78 MB
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))
-------------- Run: Debug in Locale (compiler: GNU GCC
Compiler)---------------
Checking for existence: [DRIVE]\Locale.exe
Executing: "[DRIVE]\CodeBlocks\Locale\bin\Debug\Locale.exe" (in
C:\Users\Papa\Documents\CodeBlocks\Locale\bin\Debug)
Process terminated with status 255 (0 minute(s), 4 second(s))
=================================================
How can I solve this problem?
Thanks.
On 02-May-2017 12:27 AM, Xi Ruoyao wrote:
On 2017-05-02 00:08 -0400, Papa wrote:
COLLECT_GCC=C:\gnu\mingw-w64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/gnu/mingw-w64/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/6.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
OS: Win 8.1
class myClass{
private:
std::locale current_locale;
public:
void setGlobalLocale(const std::string& str) {
current_locale.global(std::locale(str.data()));
//<<Segmentation fault>>
Are you sure this is a segfault?
}
};
On 01-May-2017 11:57 PM, Papa wrote:
COLLECT_GCC=C:\gnu\mingw-w64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/gnu/mingw-w64/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/6.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
OS: Win 8.1
class{
private:
std::locale current_locale;
public:
void setGlobalLocale(const std::string& str) {
current_locale.global(std::locale(str)); //<< RunTimeError>>
}
};
I'm writing a wrapper for std::locale, but right at start-up the first
problem.
Why would this member function give me a Run Time Error?
Any help is much appreciated.
Currently libstdc++ only supports "C" locale on Windows.
See <http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html>.
If you are trying to create a std::locale which is not "C", you'll likely
get
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Windows has some strange undocumented APIs for manipulating
locales. So it's difficult to implement std::locale for Windows.
--
ArbolOne.ca
Using FireFox and Thunderbird.
ArbolOne is composed of a group of students and volunteers
dedicated to providing free services to charitable organizations.