godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.76k stars 580 forks source link

Ambiguous Conversion Of 'godot::Variant' To 'godot::String' In Godot.hpp #34

Closed Kibouo closed 6 years ago

Kibouo commented 7 years ago

Problem: Was following every step of the README. However, when running clang -fPIC -o src/init.os -c src/init.cpp -g -O3 -std=c++14 -Icpp_bindings/include -Igodot_headers -Icpp_bindings/include/ a few errors occur.

Most are easy to resolve (unable to find included files due to incorrect path). But then there is following In file included from src/init.cpp:1: cpp_bindings/include/core/Godot.hpp:64:42: error: ambiguous conversion for static_cast from 'godot::Variant' to 'godot::String' static T _arg_cast(Variant a) { return static_cast<T>(a); }

Same error occurs when using GCC.

Info:

  1. godot3.0 25f742c (from 15 Sept 2017)
  2. godot-cpp e32d7bb (15 Sept 2017)
  3. clang 4.0.1-5 / gcc 7.2.0-2
karroffel commented 7 years ago

Ah yes, I should get around to fix that.

The problem is that some compilers like to see a.operator T(), other's like to see static_cast<T>(a), I should figure out which compiler wants what or if there's a proper way to deal with this in C++.

So for now if you just want to get it working then try a.opeator T() or maybe (T) a too.


If some C++ guru knows how to best fix that problem - feel free to tell me or make a PR 😂

RameshRavone commented 7 years ago

39 should've fixed this