次の簡単なコード例をコンパイルしようとすると、次のようになります。
echo "#include <cmath>" | g++ -x c++ -c - -m64 -mfpmath=both -std=gnu++11 -o /dev/null
(オプションとともに、-m64
(デフォルトで)SSE(たとえば、AVX)を使用してアクティブ化されます)。
次のエラーメッセージが表示されます。
In file included from <stdin>:1:0:
c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/cmath:1040:11: error: '::double_t' has not been declared
c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../include/c++/4.7.2/cmath:1041:11: error: '::float_t' has not been declared
これはバグですか?
-mfpmath=both
オプションがないと、エラーは発生しません。
私の回避策は、g ++のオプションリストに-D__FLT_EVAL_METHOD__=2
(および存在-Wp,-w
する場合-Werror
は「再定義された」警告のために)追加することです。これは汚い方法だと思います。