Quadlodsを SmartOSに移植しようとしています。Linux および DragonFly BSD でコンパイルおよび実行されます。Windows で実行しようとしたことはありませんが、isfinite メソッドで xy クラスを使用する他のプログラムは、コンパイルして Windows で実行します。ただし、SmartOS でコンパイルすると、次のエラーが発生します。
[ 15%] Building CXX object CMakeFiles/quadlods.dir/filltest.cpp.o
In file included from /usr/include/math.h:36,
from /opt/local/gcc9/include/c++/9.3.0/bits/std_abs.h:40,
from /opt/local/gcc9/include/c++/9.3.0/cstdlib:77,
from /opt/local/gcc9/include/c++/9.3.0/ext/string_conversions.h:41,
from /opt/local/gcc9/include/c++/9.3.0/bits/basic_string.h:6493,
from /opt/local/gcc9/include/c++/9.3.0/string:55,
from /opt/local/gcc9/include/c++/9.3.0/stdexcept:39,
from /opt/local/gcc9/include/c++/9.3.0/optional:38,
from /opt/local/gcc9/include/c++/9.3.0/bits/node_handle.h:39,
from /opt/local/gcc9/include/c++/9.3.0/bits/stl_tree.h:72,
from /opt/local/gcc9/include/c++/9.3.0/map:60,
from /home/phma/src/quadlods/quadlods.h:27,
from /home/phma/src/quadlods/filltest.h:25,
from /home/phma/src/quadlods/filltest.cpp:26:
/home/phma/src/quadlods/xy.h:35:8: error: expected ')' before '!=' token
35 | bool isfinite() const;
| ^~~~~~~~
この奇妙なエラーを引き起こすマクロを定義するファイルは、/usr/include/iso/math_c99.h です。
#define isfinite(x) (__builtin_isfinite(x) != 0)
ヘッダー ファイルのクラス定義は次のとおりです。
class xy
{
public:
xy(double e,double n);
xy();
double getx() const;
double gety() const;
double length() const;
bool isfinite() const;
bool isnan() const;
friend xy operator+(const xy &l,const xy &r);
friend xy operator+=(xy &l,const xy &r);
friend xy operator-=(xy &l,const xy &r);
friend xy operator-(const xy &l,const xy &r);
friend xy operator-(const xy &r);
friend xy operator*(const xy &l,double r);
friend xy operator*(double l,const xy &r);
friend xy operator/(const xy &l,double r);
friend xy operator/=(xy &l,double r);
friend bool operator!=(const xy &l,const xy &r);
friend bool operator==(const xy &l,const xy &r);
friend xy turn90(xy a);
friend xy turn(xy a,int angle);
friend double dist(xy a,xy b);
protected:
double x,y;
};
メソッドの名前を変更せずに SmartOS でこれをコンパイルすることは可能ですか? isfinite マクロを未定義にしようと思ったのですが、別のプログラム (ヘッダー ファイルが quadlods.h だけの Quadlods ではない) では、ライブラリのヘッダー ファイルに xy クラスが含まれています。また、isfinite メソッドは std::isfinite を呼び出します。