Problem:
I want to hold an instance of Node and operate over it. Just like in the following example:
package;
import facebook.Yoga;
import facebook.yoga.Node;
import facebook.yoga.Layout;
import facebook.yoga.Enums.Direction;
class Main {
private final node: Node = Yoga.newNode();
public function new() {
node.setLayout(Layout.init());
Yoga.nodeCalculateLayout(node, 200.0, 200.0, Direction.LTR);
}
static function main() {
new Main();
}
}
It doesn’t compile with error:
C:/HaxeToolkit/haxe/lib/hxcpp/git/include/cpp/Variant.h: In instantiation of 'RETURN_ cpp::Variant::Cast() const [with RETURN_ = YGNode*]':
./src/Main.cpp:102:70: required from here
C:/HaxeToolkit/haxe/lib/hxcpp/git/include/cpp/Variant.h:150:37: error: invalid cast from type 'const cpp::Variant' to type 'YGNode*'
RETURN_ Cast() const { return RETURN_(*this); }
If I make node a local variable like this: var node: Node = Yoga.newNode(); it’s working…
In file included from ./src/__main__.cpp:11:0:
include/Main.h:11:10: fatal error: linc_yoga.h: No such file or directory
#include "linc_yoga.h"
^~~~~~~~~~~~~
compilation terminated.
Error: Build failed