Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dianshane |
Hello,
I am a developer and have used other engines in the past. I wanted to use Godot because of its open source and I love it. BUT…
I have compiled the engine and headers and everything works fine but when i try to use the register_class function to expose one of my classes to Godot I always get the same conversion error (located initially in the Godot header).
I am not accustomed to the structure of Godot and thus could not trace this error back.
Here is the code, I hope someone has some idea where to start because i have a whole game waiting to be built, and its the only thing missing.
Note: i am using g++ 9.3 (c++14) on windows 10 64bits (mingw).
The debug is as follows :
(don’t worry about the warning since it’s not critical-the problem starts where it sais no math converting yada yada)
In file included from ./src/library.cpp:1:
./include/core/Godot.hpp:351:3: warning: unnecessary parentheses in declaration of ‘f’ [-Wparentheses]
351 | P(T::f);
| ^
./include/core/Godot.hpp:364:3: warning: unnecessary parentheses in declaration of ‘f’ [-Wparentheses]
364 | P(T::f);
| ^
./include/core/Godot.hpp: In instantiation of ‘void godot::register_class() [with T = godot::GDTest]’:
./src/library.cpp:17:40: required from here
./include/core/Godot.hpp:177:21: error: no matches converting function ‘_godot_class_instance_func’ to type ‘void (attribute((sysv_abi)) )(godot_object, void)’ {aka ‘void* (attribute((sysv_abi)) )(void, void*)’}
177 | create.create_func = _godot_class_instance_func;
| ~~~~~~~~~~~~~^
./include/core/Godot.hpp:160:7: note: candidate is: ‘template void* godot::_godot_class_instance_func(godot_object*, void*)’
160 | void _godot_class_instance_func(godot_object p, void method_data) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
./include/core/Godot.hpp:180:23: error: no matches converting function ‘_godot_class_destroy_func’ to type ‘void (attribute((sysv_abi)) )(godot_object, void, void)’ {aka ‘void (attribute((sysv_abi)) )(void, void, void*)’}
180 | destroy.destroy_func = _godot_class_destroy_func;
| ~~~~~~~~~~^
./include/core/Godot.hpp:169:6: note: candidate is: ‘template void godot::_godot_class_destroy_func(godot_object*, void*, void*)’
169 | void _godot_class_destroy_func(godot_object *p, void *method_data, void *data) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Hi! can we see the code of your custom class?
p7f | 2020-07-14 15:36