Я новичок в использовании 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?
Похоже на тебя
<cstdlib>
Других решений пока нет …