2021年3月2日

Macのg++-10がいつのまにか使えなくなっていたのに対応。

現象。

$ g++-10 test.cpp 
In file included from /usr/local/Cellar/gcc/10.1.0/include/c++/10.1.0/bits/stl_algo.h:59,
                 from /usr/local/Cellar/gcc/10.1.0/include/c++/10.1.0/algorithm:62,
                 from ../sdouble.hpp:29,
                 from test.cpp:1:
/usr/local/Cellar/gcc/10.1.0/include/c++/10.1.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
   75 | #include_next <stdlib.h>
      |               ^~~~~~~~~~
compilation terminated.

などと言われ、ヘッダファイルのパスが見つからない。アンインストールしようとしたら、

$ brew uninstall gcc
Error: Refusing to uninstall /usr/local/Cellar/gcc/10.1.0
because it is required by boost-mpi, fftw, kim-api, lammps, open-mpi, openblas and r, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies gcc

などと怒られたので、再インストールしてみる。

brew reinstall gcc
g++-10 test.cpp

コンパイルして、ヘッダが見つからないと言われないことを確認。なおってよかった。

なんかデフォルトブランチがmainとmasterが混在していて鬱陶しいので少しずつmainに修正。

stat::sdoubleライブラリを修正。やっぱり<<で値を追加する必要はないと判断。普通にstd::vector<double>を使うことにして、ライブラリでは誤差伝搬だけを考えることにする。