std::locale

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In this web page:
http://en.cppreference.com/w/cpp/locale/toupper

I got this code:
#include <iostream>
#include <cwctype>
#include <locale>

int main()
{
   wchar_t c = L'\u017f'; // Latin small letter Long S ('ſ')
   std::cout << std::hex << std::showbase;
std::cout << "in the default locale, toupper(" << (std::wint_t)c << ") = "
             << std::toupper(c, std::locale()) << '\n';
   std::cout << "in Unicode locale, toupper(" << (std::wint_t)c << ") = "
             << std::toupper(c, std::locale("en_US.utf8")) << '\n';
}

Which compiles like this:
g++.exe -Wall -fexceptions -g -m64 -std=gnu++14 -D_UNICODE -D_WIN32 -march=core2 -pedantic -std=c++11 -m64 -std=gnu++14 -D_UNICODE -D_WIN32 -IC:\dev\jme -c C:\tmp\localetest01\main.cpp -o obj\Debug\main.o
g++.exe  -o bin\Debug\localetest01.exe obj\Debug\main.o  -lwinmm -lwinmm
Output file is bin\Debug\localetest01.exe with size 108.41 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Then I get a popup box with this message
---------------------------
localetest01.exe - System Error
---------------------------
The program can't start because libgcc_s_seh-1.dll is missing from your computer. Try reinstalling the program to fix this problem.
---------------------------
OK
---------------------------

Which does not make sense since my compiler's exceptions are 'sjlj', go figure!
I click OK, and then a cmd terminal comes saying:
int he default locale. touppor(0x17f) = 0x17f
terminate called after throwing an instance of 'std::runtime_error'
  what(): locase::facet::_S_reate_c_locale name not valid

I am using:
g++ : Using built-in specs.
At line:1 char:1
+ g++ -v 2> GCC_version.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Using built-in specs.:String) [], RemoteException
   + FullyQualifiedErrorId : NativeCommandError

COLLECT_GCC=[DRIVE:]\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=[DRIVE:]/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32
--target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw482/x86_64-482-posix-sjlj-rt_v3-rev4/mingw64
--with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --enable-targets=all
--enable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes
--enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-sjlj-exceptions
--disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --d isable-symvers --with-gnu-as --with-gnu-ld --with-arch-32=i686 --with-arch-64=nocona --with-tune-32=generic
--with-tune-64=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw482/prerequisites/x86_64-w64-mingw32-static
--with-mpfr=/c/mingw482/prerequisites/x86_64-w64-mingw32-static
--with-mpc=/c/mingw482/prerequisites/x86_64-w64-mingw32-static
--with-isl=/c/mingw482/prerequisites/x86_64-w64-mingw32-static
--with-cloog=/c/mingw482/prerequisites/x86_64-w64-mingw32-static --enable-cloog-backend=isl
--with-pkgversion='x86_64-posix-sjlj-rev4, Built by MinGW-W64 project'
--with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe
-I/c/mingw482/x86_64-482-posix-sjlj-rt_v3-rev4/mingw64/opt/include
-I/c/mingw482/prerequisites/x86_64-zlib-static/include -I/c/mingw482/prerequisites/x86_64-w64-mingw32-static/include'
CXXFLAGS='-O2 -pipe -I/c/mingw482/x86_64-482-posix-sjlj-rt_v3-rev4/mingw64/opt/include
-I/c/mingw482/prerequisites/x86_64-zlib-static/include -I/c/mingw482/prerequisites/x86_64-w64-mingw32-static/include'
CPPFLAGS= LDFLAGS='-pipe -L/c/mingw482/x86_64-482-posix-sjlj-rt_v3-rev4/mingw64/opt/lib -L/c/mingw482/prerequisites/x86_64-zlib-static/lib -L/c/mingw482/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 4.8.2 (x86_64-posix-sjlj-rev4, Built by MinGW-W64 project)

Can anyone shed some light into this, thanks in advance.


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux