Unable to compile in CPP

I’ve tried to compile a native binary and I keep running into this problem. I don’t know if it’s based on my UI framework, Haxe 4 or OpenFL but I would love input on how to solve this problem.

You can download the code here:

After you download the source extend the demo class.


import openfl.display.Sprite;

class Main extends UIDemo
public function new()

Here is the output from the error. Error: In file included from /home/erick/haxelib/hxcpp/4,0,64/include/hxcpp.h:347:0: /home/erick/haxelib/hxcpp/4,0,64/include/hx/Object.h: In instantiation of ‘hx::ObjectPtr::ObjectPtr(const SOURCE_*, bool) [with SOURCE_ = com::chaos::ui::Label_obj; OBJ_ = hx::Object]’: /home/erick/haxelib/hxcpp/4,0,64/include/Dynamic.h:102:53: required from ‘Dynamic::Dynamic(const hx::ObjectPtr&) [with SOURCE_ = com::chaos::ui::Label_obj]’ ./src/com/chaos/ui/ProgressSlider.cpp:280:27: required from here /home/erick/haxelib/hxcpp/4,0,64/include/hx/Object.h:358:17: error: no matching function for call to ‘hx::ObjectPtr::CastPtr(com::chaos::ui::Label_obj*, bool&)’ CastPtr(const_cast(inPtr),inCheckCast); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/erick/haxelib/hxcpp/4,0,64/include/hx/Object.h:306:16: note: candidate: void hx::ObjectPtr::CastPtr(hx::Object*, bool) [with OBJ_ = hx::Object] inline void CastPtr(hx::Object *inPtr,bool inThrowOnInvalid) ^~~~~~~ /home/erick/haxelib/hxcpp/4,0,64/include/hx/Object.h:306:16: note: no known conversion for argument 1 from ‘com::chaos::ui::Label_obj*’ to ‘hx::Object*’

What is the generated C++ source for ProgressSlider.cpp? What line does it correspond to in the original Haxe source? Perhaps something needs to be typed and not Dynamic?

That is correct, this happen on Windows 10 and Linux when creating the files. It look like it happens on line 280 on the ProgressSlider.cpp file but I have no clue how to fix the problem at this point. If there are any adjustments I could make to my ProgressSlider or Label class I’ll be willing to make the changes for CPP compiles.

Could you share some of the CPP file contents around line 280 for us to see?

Here is a link to the file on my dropbox account.

I thought I might have been able to spot the issue but this looks ultimately like a bug in the HXCPP headers or possibly the generated C++ source but my bet would be on HXCPP needing a tweak to support this generated code. Hugh would be the best person to know why these types aren’t matching up

1 Like

How do we get Hugh into the mix then? Like I said I’m willing to do anything I can on my end to help. I knew version 1.x worked before and I was able to get a HXCPP version of my last project up and running with some minor changes. However I switched things around a lot for version 2.x for the CHAOS UI Framework and wanted to know what broke/change in the process.

Could you try opening an issue here?

1 Like

Sure thing, I’ll see what I can do.