Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error: call to 'abs' is ambiguous #1382

Open
jpchen opened this issue Feb 5, 2024 · 2 comments
Open

Compilation error: call to 'abs' is ambiguous #1382

jpchen opened this issue Feb 5, 2024 · 2 comments

Comments

@jpchen
Copy link

jpchen commented Feb 5, 2024

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
Copy link
Author

jpchen commented Feb 8, 2024

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.

@Lecrapouille
Copy link

@jpchen I think I have this kind of similar issue but concerning the max function and for Windows. I'm tracking the 4.2 branch.
I appeard when I wanted to use godot::UtilityFunctions::push_error(... and I have included # include "godot_cpp/variant/utility_functions.hpp"

Here is the error log: https://github.com/Lecrapouille/gdcef/actions/runs/10021585672/job/27700552752#step:5:2678
And it's content:

2024-07-20T16:46:38.1875593Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(113): warning C4002: too many arguments for function-like macro invocation 'max'
2024-07-20T16:46:38.2296225Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(113): error C2988: unrecognizable template declaration/definition
2024-07-20T16:46:38.3930834Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(113): warning C4002: too many arguments for function-like macro invocation 'max'
2024-07-20T16:46:38.4102554Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(113): error C2988: unrecognizable template declaration/definition
2024-07-20T16:46:38.4106666Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(113): error C2059: syntax error: 'const'
2024-07-20T16:46:38.4131293Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(113): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
2024-07-20T16:46:38.4135099Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(124): warning C4002: too many arguments for function-like macro invocation 'min'
2024-07-20T16:46:38.4138421Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(255): error C2143: syntax error: missing ')' before ';'
2024-07-20T16:46:38.4141502Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(255): error C2988: unrecognizable template declaration/definition
2024-07-20T16:46:38.4144903Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(255): error C2059: syntax error: ')'
2024-07-20T16:46:38.4147695Z D:\a\gdcef\gdcef\addons\gdcef\thirdparty\godot-4.2\cpp\gen\include\godot_cpp/variant/utility_functions.hpp(255): error C2238: unexpected token(s) preceding ';'
2024-07-20T16:46:38.4150359Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\__msvc_minmax.hpp(19): error C2988: unrecognizable template declaration/definition
2024-07-20T16:46:38.4153114Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\__msvc_minmax.hpp(19): error C2059: syntax error: 'string'
2024-07-20T16:46:38.4159824Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\__msvc_minmax.hpp(19): error C2143: syntax error: missing ';' before '{'
2024-07-20T16:46:38.4163364Z C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\__msvc_minmax.hpp(19): error C2447: '{': missing function header (old-style formal list?)

Afaik on Linux this file does not exist and I have this issue on CI but it seems easily reproducible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants