'wchar.h' file not found で困った clang++ macOS, Error(15), c++(32)

C言語を習得する３つの方法
https://qiita.com/kaizen_nagoya/items/84cab0888c193bba429b

C言語(C++)が必要な人と必要ない人
https://qiita.com/kaizen_nagoya/items/2afe9e846b55b24cb6f1

# コンパイル
clang++で標記エラーで作業が丸２日進まなかった。

<この項は書きかけです。順次追記します。>

## コンパイルスクリプト
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da
で定義したスクリプトを使う。

```shell
#!/bin/sh
echo "clang++ $1.cpp"
clang++ $1.cpp -o $1l
./$1l $2
echo "g++-7 $1.cpp"
g++-7 $1.cpp -o $1g
./$1g $2
```

# ソースコード
CERT CPP入門(1) Rule 01. Declarations and Initialization (DCL)
https://qiita.com/kaizen_nagoya/items/61b3c431756fe8e6af3e

```dcl50n2.cpp
//clang version 6.0.0 (tags/RELEASE_600/final)
//g++-7 (Homebrew GCC 7.3.0_1) 7.3.0
#include <iostream>
#include <cstdarg>

int add(int first, int second, ...) {
  int r = first + second; 
  va_list va;
  va_start(va, second);
  while (int v = va_arg(va, int)) {
    r += v;
  }
  va_end(va);
  return r;
}  

int main(int argc, char**argv) {
  int i=1;
  i=add(argc, i);
  std::cout << i << std::endl;
  return argc;
}
```

## エラー

```shell-session
$ ./certcpp.sh dl50n2
clang++ dl50n2.cpp
In file included from dl50n2.cpp:1:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/iostream:38:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/ios:215:
In file included from /usr/local/Cellar/llvm/6.0.0/include/c++/v1/iosfwd:90:
/usr/local/Cellar/llvm/6.0.0/include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
              ^~~~~~~~~
1 error generated.
./certcpp.sh: line 4: ./dl50n2l: No such file or directory
g++-7 dl50n2.cpp
-460557205
```

# 検索
「fatal error: 'wchar.h' file not found」検索

'wchar.h' file not found
https://stackoverflow.com/questions/46342411/wchar-h-file-not-found

## 解１

```
 I was able to fix it using symbolic link. This is what I made :
```

```shell-session
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
$sudo ln -s MacOSX.sdk MacOSX10.07.sdk
```

今、10.13

```shell-session
$sudo ln -s MacOSX.sdk MacOSX10.13.sdk
```

## 解２　同じく上記URLから

```
The solution was to run CMake, 'Delete Cache', and 'Configure' the project again. 
```

```shell-session
$ brew install cmake
```

## 解3
clang++ via homebrew (llvm38) - compile error with system includes
https://stackoverflow.com/questions/37321840/clang-via-homebrew-llvm38-compile-error-with-system-includes

```shell-session
$ x-code-select --install
```

# 結果

```shell-session
$ ./certcpp.sh dl50n2
clang++ dl50n2.cpp
-698595334
g++-7 dl50n2.cpp
-292400021
```

やっと解決。何が効いたか。多分解３。

stack overvlow恐るべし。感謝。

# 参考文献
Qiitaに投稿するC, C++のStyle例(暫定)
https://qiita.com/kaizen_nagoya/items/946df1528a6a1ef2bc0d


C++ Support(0)　
https://qiita.com/kaizen_nagoya/items/8720d26f762369a80514

 Coding Rules(0) C Secure , MISRA and so on 
 https://qiita.com/kaizen_nagoya/items/400725644a8a0e90fbb0

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

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

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

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

Error一覧(C/C++, python, bash...) Error(0)
https://qiita.com/kaizen_nagoya/items/48b6cbc8d68eae2c42b8

なぜdockerで機械学習するか 書籍・ソース一覧作成中 (目標100)
https://qiita.com/kaizen_nagoya/items/ddd12477544bf5ba85e2

言語処理100本ノックをdockerで。python覚えるのに最適。:10+12
https://qiita.com/kaizen_nagoya/items/7e7eb7c543e0c18438c4

プログラムちょい替え（0）一覧:4件
https://qiita.com/kaizen_nagoya/items/296d87ef4bfd516bc394

TOPPERSまとめ　#名古屋のIoTは名古屋のOSで
https://qiita.com/kaizen_nagoya/items/9026c049cb0309b9d451

docker(0) 資料集
https://qiita.com/kaizen_nagoya/items/45699eefd62677f69c1d

Qiita-dockerお宝鑑定団
https://qiita.com/kaizen_nagoya/items/509e125263559b5aed5b

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

C++17 - The Complete Guide clang++とg++でコンパイルしてみた(まとめ):4件
https://qiita.com/kaizen_nagoya/items/c000f307e642990781e1

C++N3242, 2011, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/685b5c1a2c17c1bf1318

C++N4606 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

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

C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

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

プログラマによる、プログラマのための、統計と確率のプログラミングとその後 統計と確率一覧（０）
https://qiita.com/kaizen_nagoya/items/6e9897eb641268766909

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

＜この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。＞
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.
# 文書履歴
ver 0.10 初稿 20180324
ver 0.11 追記 20180408
ver. 0.12 ありがとう追記 20230312
### 最後までおよみいただきありがとうございました。
いいね　💚、フォローをお願いします。
####  Thank you very much for reading to the last sentence.
Please press the like icon 💚　and follow me for your happy life.