bmx-ng / math.mod

Useful maths functionality
0 stars 0 forks source link

[Math.Polygon] INT64_MAX not known in newer GCC versions #2

Open GWRon opened 6 months ago

GWRon commented 6 months ago

As William in discord pointed out he is not able to compile math.polygon.

I now installed ubuntu 23.10 in a VM and tried to compile math.polygon too: (using gcc version 13.2.0 (Ubuntu 13.2.0-4ubuntu3))

[ 57%] Compiling:clipper.rectclip.cpp
In file included from /home/ronny/Downloads/BlitzMax_linux_x64_0.143.3.57.202402180135/BlitzMax/mod/math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/include/clipper2/clipper.h:16,
                 from /home/ronny/Downloads/BlitzMax_linux_x64_0.143.3.57.202402180135/BlitzMax/mod/math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/src/clipper.offset.cpp:11:
/home/ronny/Downloads/BlitzMax_linux_x64_0.143.3.57.202402180135/BlitzMax/mod/math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/include/clipper2/clipper.core.h:29:36: error: ‘INT64_MAX’ was not declared in this scope
   29 |   static const int64_t MAX_COORD = INT64_MAX >> 2;
      |                                    ^~~~~~~~~
/home/ronny/Downloads/BlitzMax_linux_x64_0.143.3.57.202402180135/BlitzMax/mod/math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/include/clipper2/clipper.core.h:20:1: note: ‘INT64_MAX’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
   19 | #include <climits>
  +++ |+#include <cstdint>
   20 | 
/home/ronny/Downloads/BlitzMax_linux_x64_0.143.3.57.202402180135/BlitzMax/mod/math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/include/clipper2/clipper.core.h:31:34: error: ‘INT64_MAX’ was not declared in this scope
   31 |   static const int64_t INVALID = INT64_MAX;
      |                                  ^~~~~~~~~
/home/ronny/Downloads/BlitzMax_linux_x64_0.143.3.57.202402180135/BlitzMax/mod/math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/include/clipper2/clipper.core.h:31:34: note: ‘INT64_MAX’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
Build Error: failed to compile (256) /home/ronny/Downloads/BlitzMax_linux_x64_0.143.3.57.202402180135/BlitzMax/mod/math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/src/clipper.offset.cpp
Process complete

Seems for newer GCCs we need to include something more - or a newer version of the lib might already be aware of the issue.

GWRon commented 6 months ago

i added

#include <stdint.h>

(alternatively do #include <cstdint> as the error message indicates :D)

to math.mod/polygon.mod/clipper2/CPP/Clipper2Lib/include/clipper2/clipper.core.h and then it compiled - but am not sure if that is feasible for non-linux.

GWRon commented 6 months ago

Updating to the latest clipper should resolve that issue: https://github.com/AngusJohnson/Clipper2

The fix was introduced there with this commit: https://github.com/AngusJohnson/Clipper2/commit/742614f36870bfda94b0224a5ce3bf4ee52cd358

which indicates the issue begins with GCC13 (and later).