godotengine / godot-cpp

C++ bindings for the Godot script API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error: call to 'abs' is ambiguous

jpchen opened this issue · comments

commented

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).

commented

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.