CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2017

    codecvt_byname not working on Linux gcc

    gcc 7.1 with C11 linux

                  new std::codecvt_byname<wchar_t, char, std::mbstate_t>("zh_CN.gb18030")));
    terminate called after throwing an instance of 'std::runtime_error'
    what(): locale::facet::_S_create_c_locale name not valid
    Aborted (core dumped)

    The code has been taken from:

    I have tried as well with with en_US.UTF-8, but the result is the same.
    What is the problem? gcc dies not support localization library?

    Where to find valid list of locale names?
    Last edited by Pancevo1956; September 7th, 2017 at 06:56 AM. Reason: Added code tags

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012

    Re: codecvt_byname not working on Linux gcc

    See for code that displays all the valid available locale names.

    Also, from a console
    locale -a

    should also display the available names.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++20 Compiler: Microsoft VS2019 (16.11.5)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width