C Online compiler issue with cstdlib

Hi,
I’m getting an error on the online compiler. The line that starts the error (Grain.hpp:7) is #include <cstdlib>. It works on my machine so I’ve no idea.

PHP Notice: Use of undefined constant ENVIRONMENT_PRODUCTION - assumed 'ENVIRONMENT_PRODUCTION' in /var/www/hoxtonowl.com/subdomains/www/patch-builder/settings.php on line 3 PHP Notice: Constant HEAVY_TOKEN already defined in /var/www/hoxtonowl.com/subdomains/www/patch-builder/patch-builder.php on line 20 In file included from ./Source/PatchProgram.cpp:7: In file included from /tmp/owl-build-rcLvsI/registerpatch.h:1: In file included from /tmp/owl-src-KOTkLK/GrainFreezePatch.hpp:5: In file included from /tmp/owl-src-KOTkLK/Grain.hpp:7: /opt/emscripten/system/include/libcxx/cstdlib:159:53: error: expected unqualified-id inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} ^ ./LibSource/basicmaths.h:47:18: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ In file included from ./Source/PatchProgram.cpp:7: In file included from /tmp/owl-build-rcLvsI/registerpatch.h:1: In file included from /tmp/owl-src-KOTkLK/GrainFreezePatch.hpp:5: In file included from /tmp/owl-src-KOTkLK/Grain.hpp:7: /opt/emscripten/system/include/libcxx/cstdlib:159:53: error: expected ')' ./LibSource/basicmaths.h:47:18: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ /opt/emscripten/system/include/libcxx/cstdlib:159:44: note: to match this '(' inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} ^ ./LibSource/basicmaths.h:47:17: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ In file included from ./Source/PatchProgram.cpp:7: In file included from /tmp/owl-build-rcLvsI/registerpatch.h:1: In file included from /tmp/owl-src-KOTkLK/GrainFreezePatch.hpp:5: In file included from /tmp/owl-src-KOTkLK/Grain.hpp:7: /opt/emscripten/system/include/libcxx/cstdlib:159:44: error: expected ')' inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} ^ ./LibSource/basicmaths.h:47:20: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ /opt/emscripten/system/include/libcxx/cstdlib:159:44: note: to match this '(' ./LibSource/basicmaths.h:47:16: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ In file included from ./Source/PatchProgram.cpp:7: In file included from /tmp/owl-build-rcLvsI/registerpatch.h:1: In file included from /tmp/owl-src-KOTkLK/GrainFreezePatch.hpp:5: In file included from /tmp/owl-src-KOTkLK/Grain.hpp:7: /opt/emscripten/system/include/libcxx/cstdlib:161:48: error: expected unqualified-id inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ ./LibSource/basicmaths.h:47:18: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ In file included from ./Source/PatchProgram.cpp:7: In file included from /tmp/owl-build-rcLvsI/registerpatch.h:1: In file included from /tmp/owl-src-KOTkLK/GrainFreezePatch.hpp:5: In file included from /tmp/owl-src-KOTkLK/Grain.hpp:7: /opt/emscripten/system/include/libcxx/cstdlib:161:48: error: expected ')' ./LibSource/basicmaths.h:47:18: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ /opt/emscripten/system/include/libcxx/cstdlib:161:44: note: to match this '(' inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ ./LibSource/basicmaths.h:47:17: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ In file included from ./Source/PatchProgram.cpp:7: In file included from /tmp/owl-build-rcLvsI/registerpatch.h:1: In file included from /tmp/owl-src-KOTkLK/GrainFreezePatch.hpp:5: In file included from /tmp/owl-src-KOTkLK/Grain.hpp:7: /opt/emscripten/system/include/libcxx/cstdlib:161:44: error: expected ')' inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ ./LibSource/basicmaths.h:47:20: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ /opt/emscripten/system/include/libcxx/cstdlib:161:44: note: to match this '(' ./LibSource/basicmaths.h:47:16: note: expanded from macro 'abs' #define abs(x) ((x)>0?(x):-(x)) ^ 6 errors generated. ERROR root: [31mcompiler frontend failed to generate LLVM bitcode, halting[0m make[1]: *** [/tmp/owl-build-rcLvsI/web/patch.js] Error 1 make: *** [minify] Error 2 ERROR: Patch build failed.

It looks like it’s the emscripten build that fails, you might get the same error locally if you make … web
What do you need from stdlib? Did you try without the include?

If it is rand() you need then there’s no need for the include, we’ve implemented our own faster version.

Yep, it was rand(). Never thought of including basicmaths. Thanks.