このコードは、Windows の Visual Studio 2010 では正しくコンパイルされましたが、Linux では g++ でこのエラーが発生します。誰かがこれを修正する方法を説明してもらえますか?
int bits;
T scale;
std::vector<U> TwoPowers;
U cropper;
template <typename T, typename U>
ConvertToBits<T,U>::ConvertToBits(int bits, T scale)
{
this->bits = bits;
this->scale = scale;
for(long i = 0; i < 64; i++)
{
TwoPowers.push_back(static_cast<U>(pow(2.,i))); //error appears here
}
cropper = 0;
for(int i = 0; i < bits; i++)
{
cropper += TwoPowers[i];
}
}
エラーメッセージ:
エラー: テンプレート パラメーターに依存する 'pow' への引数がないため、'pow' の宣言を使用できる必要があります [-fpermissive]
ありがとうございました。