Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | AlbertCG93 |
I have the following class:
#include "core/array.h"
#include "core/object.h"
class Foo : Object {
public:
Foo() {
bar = new Array()
}
~Foo() {
delete bar;
}
Array* get_bar() {
return bar;
}
protected:
Array* bar;
}
But when I try to register it, I get both a C2027 error (undefined type with R=Array *) and a C3861 error (get_class_info identifier not found).
I’ve tried to change the class to return a Ref:
#include "core/array.h"
#include "core/object.h"
#include "core/reference.h"
class Foo : Object {
public:
Foo() {
bar = new Array()
}
~Foo() {
delete bar;
}
Ref<Array> get_bar() {
return Ref<Array>(*bar);
}
protected:
Array* bar;
}
But then I get a C2039 error (unrefence is not a member of Array).
However, there is no problem if I just return an Array, but I would rather not do that, since this is a sensitive part performance-wise.
Hm… I’m using godot-cpp/include/core/
as include directory and <Godot.hpp>
, <Array.hpp>
headers respectively for GDNative C++ script.
sash-rc | 2020-12-16 10:59