godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Compilation error: call to 'abs' is ambiguous

Open jpchen opened this issue 4 months ago • 1 comments

Godot version

4.2

godot-cpp version

4.2

System information

Mac os 10.15

Issue description

i am trying to build the godot-cpp library: scons platform=macos arch=x86_64 generate_bindings=yes and I get many such errors:

include/godot_cpp/core/math.hpp:569:9: error: call to 'abs' is ambiguous
        return std::abs(x);
               ^~~~~~~~

I am using clang 11.0.3 and I see scons is indeed passing the std=c++17 flag which should be compilable via my clang version.

Steps to reproduce

scons platform=macos arch=x86_64 generate_bindings=yes from the project directory.

Minimal reproduction project

Using either the master of 4.2 branch of the project on a macos 10.15.7 (intel chip).

jpchen avatar Feb 05 '24 03:02 jpchen

Fixed this by implementing function overloading for abs for all the different types. I can open a PR if it's something the team wants to fix, otherwise it will fail on c++17 per the instructions in the readme.

jpchen avatar Feb 08 '24 09:02 jpchen