0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Exception: locale::facet::_S_create_c_locale name not valid, The C++(83) Standard Library: clang++とg++でコンパイルしてみた(6) i18n coding(62) error(92)

Last updated at Posted at 2018-06-17

The C++ Standard Library - A Tutorial and Reference, 2nd Edition by Nicolai M. Josuttis
http://cppstdlib.com

The C++ Standard Library: clang++とg++でコンパイルしてみた(まとめ)
https://qiita.com/kaizen_nagoya/items/9bdfaa392443d13e5759

目的(purpose)

The C++ Standard Libraryコンパイル記録は、コンパイラおよび対応標準、コンパイラの版により、コンパイルエラーMessageの違いを記録し、どのエラーが出たら、どの版またはどの対応標準にすればエラーが少なくなるかを考察するための資料の第一歩です。

成果(outcome)

(1)コンパイラの種類、対応標準の違いによってエラーの数が違う。
(2)同じエラーであってもMessageの表現が違う。
(3) Error Messageのネットで検索する際に役立つ。

編纂器(compiler)

clang++

clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

g++

g++ (Homebrew GCC 8.1.0) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

編纂実行(compile and go)

i18n

i18n
clang++ ./i18n/germanbool.cpp -std=c++2a -Wall
wahr
g++ ./i18n/germanbool.cpp -std=c++2a -Wall
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
./cga.sh: line 16:  3767 Abort trap: 6           ./a.out
clang++ ./i18n/loc1.cpp -std=c++2a -Wall
input floating-point values (classic notation): 
g++ ./i18n/loc1.cpp -std=c++2a -Wall
Exception: locale::facet::_S_create_c_locale name not valid
i18n2
$ ../cga.sh i18n2
clang++ loc2.cpp -std=c++2a -Wall

Locale for input: 
Exception: collate_byname<char>::collate_byname failed to construct for moneymanipulator.cpp
g++ loc2.cpp -std=c++2a -Wall
Exception: locale::facet::_S_create_c_locale name not valid
i18n3
$ ../cga.sh i18n3
clang++ moneymanipulator.cpp -std=c++2a -Wall
monetary value: invalid format
g++ moneymanipulator.cpp -std=c++2a -Wall
Exception: locale::facet::_S_create_c_locale name not valid
i18n4
$ ../cga.sh i18n4
clang++ moneypunct.cpp -std=c++2a -Wall
moneypunct in locale "C":
 decimal_point: 
 thousands_sep: 
 grouping:      
 curr_symbol:   
 positive_sign: 
 negative_sign: 
 frac_digits:   0
 pos_format:    symbol sign none value 
 neg_format:    symbol sign none value 

Exception: collate_byname<char>::collate_byname failed to construct for german
g++ moneypunct.cpp -std=c++2a -Wall
moneypunct.cpp: In instantiation of 'void printMoneyPunct(const string&) [with bool intl = false; std::__cxx11::string = std::__cxx11::basic_string<char>]':
moneypunct.cpp:60:35:   required from here
moneypunct.cpp:45:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
     for (int i=0; i<mp.grouping().size(); ++i) {
moneypunct.cpp: In instantiation of 'void printMoneyPunct(const string&) [with bool intl = true; std::__cxx11::string = std::__cxx11::basic_string<char>]':
moneypunct.cpp:64:39:   required from here
moneypunct.cpp:45:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
moneypunct in locale "C":
 decimal_point: .
 thousands_sep: ,
 grouping:      
 curr_symbol:   
 positive_sign: 
 negative_sign: 
 frac_digits:   0
 pos_format:    symbol sign none value 
 neg_format:    symbol sign none value 

Exception: locale::facet::_S_create_c_locale name not valid
clang++ numget.cpp -std=c++2a -Wall
format error while reading numeric value
g++ numget.cpp -std=c++2a -Wall
format error while reading numeric value
i18n5
$ ../cga.sh i18n5
clang++ numput.cpp -std=c++2a -Wall
1234.57
1234,57
g++ numput.cpp -std=c++2a -Wall
1234.57
Exception: locale::facet::_S_create_c_locale name not valid
clang++ timeget.cpp -std=c++2a -Wall
Exception: collate_byname<char>::collate_byname failed to construct for de_DE.ISO-8859-1
g++ timeget.cpp -std=c++2a -Wall
Exception: locale::facet::_S_create_c_locale name not valid
clang++ timeput.cpp -std=c++2a -Wall
06/17/18
Sunday 06/17/18 11AM
17.06.2018
Sonntag 17.06.2018 11am
g++ timeput.cpp -std=c++2a -Wall
06/17/18
Sunday 06/17/18 11AM
Exception: locale::facet::_S_create_c_locale name not valid
clang++ wbuffer.cpp -std=c++2a -Wall
??w??string2string.cpp
wstring2utf8.cpp
g++ wbuffer.cpp -std=c++2a -Wall
wbuffer.cpp: In function 'int main()':
wbuffer.cpp:19:5: error: 'wbuffer_convert' was not declared in this scope
     wbuffer_convert<codecvt_utf8<wchar_t>> utf8inBuf(cin.rdbuf());
     ^~~~~~~~~~~~~~~
wbuffer.cpp:19:41: error: expected primary-expression before '>' token
     wbuffer_convert<codecvt_utf8<wchar_t>> utf8inBuf(cin.rdbuf());
                                         ^~
wbuffer.cpp:19:44: error: 'utf8inBuf' was not declared in this scope
     wbuffer_convert<codecvt_utf8<wchar_t>> utf8inBuf(cin.rdbuf());
                                            ^~~~~~~~~
wbuffer.cpp:25:50: error: expected primary-expression before '>' token
                                   generate_header>>
                                                  ^~
wbuffer.cpp:26:20: error: 'utf16outBuf' was not declared in this scope
                    utf16outBuf(cout.rdbuf());
                    ^~~~~~~~~~~
i18n6

$ ../cga.sh i18n6
clang++ wstring2string.cpp -std=c++2a -Wall
hello, world
hello, world
g++ wstring2string.cpp -std=c++2a -Wall
hello, world
hello, world
clang++ wstring2utf8.cpp -std=c++2a -Wall
Exception: collate_byname<char>::collate_byname failed to construct for de_DE.ISO-8859-15
g++ wstring2utf8.cpp -std=c++2a -Wall
Exception: locale::facet::_S_create_c_locale name not valid

検討事項(agenda)

  1. コンパイルエラーをなくす修正方法
  2. 役に立つまたは意味のあるその他の出力

参考資料(reference)

プログラミング言語教育のXYZ
https://qiita.com/kaizen_nagoya/items/1950c5810fb5c0b07be4
プログラミング言語教育のXYZ(youtube)
https://www.youtube.com/watch?v=He1_tg4px-w&t=486s

Autosar Guidelines C++14 example code compile list(1-169)
https://qiita.com/kaizen_nagoya/items/8ccbf6675c3494d57a76

C++N4741 2018 Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4741.pdf

C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
https://qiita.com/kaizen_nagoya/items/3294c014044550896010

C++N4606 2016 Working Draft, Standard for Programming Language C++
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf

C++N4606, 2016符号断片編纂一覧(example code compile list)
Working Draft 2016, ISO/IEC 14882(1)
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

CEDD(Compile Error Driven Design)
初めての CEDD(Compile Error Driven Design) 8回直してコンパイル。
https://qiita.com/kaizen_nagoya/items/9494236aa1753f3fd1e1

コンパイルエラーを記録するとよい理由7つ
https://qiita.com/kaizen_nagoya/items/85c0e92b206883140e89
docker gnu(gcc/g++) and llvm(clang/clang++)
https://qiita.com/drafts/059874ea39c4de64c0f7

[C][C++]の国際規格案の例題をコンパイルするときの課題7つ。
https://qiita.com/kaizen_nagoya/items/5f4b155030259497c4de

C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standardのコード断片をコンパイルするためにしていること
https://qiita.com/kaizen_nagoya/items/a8d7ee2f2e29e76c19c1

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da

Clang/Clang++(LLVM) gcc/g++(GNU) コンパイラ警告等比較
https://qiita.com/kaizen_nagoya/items/9a82b958cc3aeef0403f

C++2003とC++2017でコンパイルエラーになるならない事例集
https://qiita.com/kaizen_nagoya/items/a13ea3823441c430edff

Qiitaに投稿するCのStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d

cpprefjpのdecltypeをコンパイル試験
https://qiita.com/kaizen_nagoya/items/090909af702f0d5d8a67

MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

C++ Templates Part1 BASICS Chapter 3. Class Templates 3.2 Use of Class Template Stack stack1test.cpp
https://qiita.com/kaizen_nagoya/items/cd5fc49106fad5a4e9ed

ISO/IEC TS 17961:2013 C Secure Coding Rules(1) All list(to be confirmed)
https://qiita.com/kaizen_nagoya/items/54e056195c4f11b850a1

C言語(C++)に対する誤解、曲解、無理解、爽快。
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9

'wchar.h' file not found で困った clang++ macOS
https://qiita.com/kaizen_nagoya/items/de15cd46d657517fac11

Open POSIX Test Suiteの使い方を調べはじめました
https://qiita.com/kaizen_nagoya/items/644d5e407f5faf96e6dc

MISRA-C 2012 Referenceに掲載している文献の入手可能性を確認
https://qiita.com/kaizen_nagoya/items/96dc8b125e462d5575bb

どうやって MISRA Example Suiteをコンパイルするか
https://qiita.com/kaizen_nagoya/items/fbdbff5ff696e2ca7f00

MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9

「C++完全理解ガイド」の同意できること上位10
https://qiita.com/kaizen_nagoya/items/aa5744e0c4a8618c7671

Reference

無線網(Wi-Fi)空中線(antenna)(0) 記事一覧(118/300目標)
https://qiita.com/kaizen_nagoya/items/5e5464ac2b24bd4cd001

Ethernet 記事一覧 Ethernet(0)
https://qiita.com/kaizen_nagoya/items/88d35e99f74aefc98794

Wireshark 一覧 wireshark(0)、Ethernet(48) https://qiita.com/kaizen_nagoya/items/fbed841f61875c4731d0

仮説(0)一覧(目標100現在40)
https://qiita.com/kaizen_nagoya/items/f000506fe1837b3590df

安全(0)安全工学シンポジウムに向けて: 21
https://qiita.com/kaizen_nagoya/items/c5d78f3def8195cb2409

Qiita(0)Qiita関連記事一覧(自分)
https://qiita.com/kaizen_nagoya/items/58db5fbf036b28e9dfa6

鉄道(0)鉄道のシステム考察はてっちゃんがてつだってくれる
https://qiita.com/kaizen_nagoya/items/26bda595f341a27901a0

日本語(0)一欄
https://qiita.com/kaizen_nagoya/items/7498dcfa3a9ba7fd1e68

英語(0) 一覧
https://qiita.com/kaizen_nagoya/items/680e3f5cbf9430486c7d

転職(0)一覧
https://qiita.com/kaizen_nagoya/items/f77520d378d33451d6fe

数学関連記事100 
https://qiita.com/kaizen_nagoya/items/d8dadb49a6397e854c6d

物理記事 上位100
https://qiita.com/kaizen_nagoya/items/66e90fe31fbe3facc6ff

自動車 記事 100
https://qiita.com/kaizen_nagoya/items/f7f0b9ab36569ad409c5

言語・文学記事 100
https://qiita.com/kaizen_nagoya/items/42d58d5ef7fb53c407d6

医工連携関連記事 100
https://qiita.com/kaizen_nagoya/items/6ab51c12ba51bc260a82

通信記事100
https://qiita.com/kaizen_nagoya/items/1d67de5e1cd207b05ef7

OSEK OS設計の基礎 OSEK(100)
https://qiita.com/kaizen_nagoya/items/7528a22a14242d2d58a3

一覧:携帯計画者日記(0)
https://qiita.com/kaizen_nagoya/items/005d38c6f55c85570e74

AUTOSAR R22-11 Qiita記事一覧 20230421(1)
https://qiita.com/kaizen_nagoya/items/81a35774f1aa3d64d3f6

ボッシュ自動車handbook(英語)11版(0) 課題と記事一覧
https://qiita.com/kaizen_nagoya/items/dfa35aa6f669e5df983e

R3(0) on "What are the most important statistical ideas of the past 50 years? " Andrew Gelman, Aki Vehtari
https://qiita.com/kaizen_nagoya/items/a8eac9afbf16d2188901

官公庁・学校・公的団体(NPOを含む)システムの課題、官(0)
https://qiita.com/kaizen_nagoya/items/04ee6eaf7ec13d3af4c3

一覧の一覧( The directory of directories of mine.) Qiita(100)
https://qiita.com/kaizen_nagoya/items/7eb0e006543886138f39

プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945

LaTeX(0) 一覧 
https://qiita.com/kaizen_nagoya/items/e3f7dafacab58c499792

自動制御、制御工学一覧(0)
https://qiita.com/kaizen_nagoya/items/7767a4e19a6ae1479e6b

Rust(0) 一覧 
https://qiita.com/kaizen_nagoya/items/5e8bb080ba6ca0281927

小川清最終講義、最終講義(再)計画, Ethernet(100) 英語(100) 安全(100)
https://qiita.com/kaizen_nagoya/items/e2df642e3951e35e6a53

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
This article is an individual impression based on the individual's experience. It has nothing to do with the organization or business to which I currently belong.

文献履歴(document history)

ver. 0.10 初稿 20180616
ver. 0.11 まとめURL追記 20180625

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?