LoginSignup
14
5

More than 3 years have passed since last update.

macOSをアップデートしたらg++でwchar.hが見つからなくなった

Last updated at Posted at 2018-11-06

あらすじ

MacのOSをMojaveにアップデートしたら、g++でビルド出来なくなった。

これはビルド出来る
int main(){}
これはビルド出来ない
#include <iostream>
int main(){}

エラーは以下の通り

In file included from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/bits/postypes.h:40,
                 from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/iosfwd:40,
                 from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/ios:38,
                 from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/ostream:38,
                 from /usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/iostream:39,
                 from Main.cpp:8:
/usr/local/Cellar/gcc/8.2.0/include/c++/8.2.0/cwchar:44:10: fatal error: wchar.h: No such file or directory
 #include <wchar.h>
          ^~~~~~~~~
compilation terminated.

解決方法

  • xcodeを再インストールした。
  • gccを再インストールした。

gccの再インストールは、homebrewのreinstallを使用した。

brew reinstall gcc
14
5
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
14
5