0

私は emscripten を使用する初心者で、cpp ファイルのコンパイル中にエラーが発生しました。

私はiae.cppを持っています:

bool IsAlmostEqual(double A, double B)
{
  //http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
  long long aInt = reinterpret_cast<long long&>(A);
  if (aInt < 0) aInt = -9223372036854775808LL - aInt;
  long long bInt = reinterpret_cast<long long&>(B);
  if (bInt < 0) bInt = -9223372036854775808LL - bInt;
  return (std::abs(aInt - bInt) <= 10000);
}

emscripten を使用してコンパイルしようとしました:

emcc iae.cpp

ただし、次の警告とエラーが生成されます。

INFO     root: (Emscripten: Running sanity checks)
WARNING  root: java does not seem to exist, required for closure compiler. -O2 and above will fail. You need to define JAVA in ~/.emscripten
iae.cpp:5:27: warning: integer constant is so large that it is unsigned
    if (aInt < 0) aInt = -9223372036854775808LL - aInt;
                          ^
iae.cpp:7:27: warning: integer constant is so large that it is unsigned
    if (bInt < 0) bInt = -9223372036854775808LL - bInt;
                          ^
iae.cpp:8:13: error: use of undeclared identifier 'std'
    return (std::abs(aInt - bInt) <= 10000);
            ^
2 warnings and 1 error generated.
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting

これらの警告とエラーを取り除く方法と、IsAlmostEqual()emscripten を使用してコンパイルすることさえ可能ですか?

4

1 に答える 1

1

あなたのように見える

  1. インクルードを逃した<cstdlib>
  2. Javascript でネイティブにサポートされていない 64 ビット値を使用してみてください。これを行うことはできますが、パフォーマンスが犠牲になります。ガイダンスについては、https://github.com/kripken/emscripten/wiki/CodeGuidelinesAndLimitationsを参照してください。
于 2014-02-01T08:51:38.487 に答える