------- Additional Comments From jpr at essi dot fr 2005-04-30 18:45 ------- Subject: Re: Configuring g++ library for various locales ?
pinskia at gcc dot gnu dot org wrote: >------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-30 >14:56 ------- >What option are you taking about? > >The standard way of changing the locale is either by the LC_*/LANG environment >variable or using the >locale class. > > > I know that. I am precisely trying to use the locale class ! Here is my test program //------------------------------------------------------- #include <locale> #include <iostream> using namespace std; int main(int argc, char *argv[]) { char *loc = ""; if (argc > 1) loc = argv[1]; cout << "Trying locale : " << loc << endl; locale::global(locale(loc)); return 0; } //------------------------------------------------------- If I compile it with g++-3.4 or g++-4.0.0, the compilation is fine, but at run time I get an std::runtime_error if I try any locale except C and POSIX ! For instance 5-kheops% locale fr_FR Trying locale : fr_FR terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid zsh: abort locale fr_FR 5-kheops% or 5-kheops% locale de_DE Trying locale : de_DE terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid zsh: abort locale de_DE 5-kheops% But, if I compile this programm with g++-3.3.2, it does not throw. And the locales are corrrectly installed on my machine and setlocale() works with C... Thus I guessed (maybe wrongly) that it had something to do with my configuration when building gcc-3.4 and gcc-4 , Any help would be appreciated. Best regards Jean-Paul Rigault -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21295