RegisterClass(A/W) not a member of hx

84 views
Skip to first unread message

Luke Selman

unread,
Mar 14, 2016, 1:56:47 PM3/14/16
to Haxe
I am having this annoying issue when adding and implementing additional externs to my own libraries, as well as hxWidgets and keep getting the error "RegisterClassA" or "RegisterClassW not a member of hx".

I read up on this StackOverflow issue posted 3 years ago, and followed the steps suggested in the accepted answer, but to no avail, causing the same error regardless of which implementation of "RegisterClass" I undef.

I'm currently using the git version of hxcpp to build projects at the moment, to take advantage of cpp::Reference.

Now the above StackOverflow issue is about using the "windows.h" include file, but with that said I'm not touching that include due to that very experience. I was creating a separate project earlier attempting to use "windows.h" for creating a native binding for Win32 for learning purposes, but because of this issue I gave up after following that same suggestion.

Below is the code I'm attempting to implement into hxWidgets:

package wx.widgets;

import cpp.ConstCharStar;

@:include("wx/glcanvas.h")
@:unreflective
@:native("cpp::Reference<wxGLCanvas>")
extern class GLCanvas extends GLCanvasImpl {
   
@:native("new wxGLCanvas")      public static function createInstance(parent:Window, id:Int):GLCanvas;
}

@:include("wx/glcanvas.h")
@:unreflective
@:native("wxGLCanvas")
extern class GLCanvasImpl extends Window {
   
@:native("SetColour")       public function setColour(colour:ConstCharStar):Bool;
}

And here is the wrapper:

package hx.widgets;

import wx.widgets.GLCanvas in WxGLCanvas;

class GLCanvas extends Window {
   
   
public function new(parent:Window = null, id:Int = -1) {
       
super();
       
       
var canvas:WxGLCanvas = WxGLCanvas.createInstance(parent == null ? cast 0 : parent._ref, id);
        _ref
= cast canvas;
   
}
   
   
public function setColour(name:String) {
        glCanvasRef
.setColour(name);
   
}
   
   
private var glCanvasRef(get, null):WxGLCanvas;
   
private inline function get_glCanvasRef():WxGLCanvas {
       
return cast _ref;
   
}
   
}

Any help would be greatly appreciated.

Luke Selman

unread,
Mar 16, 2016, 6:40:09 AM3/16/16
to Haxe
I've restarted my computer, thinking it may help, but didn't change the situation.

I've also got a screenshot here, not sure if it will help:

The Build.xml file hasn't changed and that still includes the UNICODE flags as you would expect, not sure if that's got anything to do with it...

Robert Konrad

unread,
Mar 16, 2016, 9:55:50 AM3/16/16
to Haxe
Something includes windows.h indirectly, probably wx/glcanvas.h. Guess your undef is wrong. You need to undef RegisterClass (without A or W).

Robert Konrad

unread,
Mar 16, 2016, 9:57:29 AM3/16/16
to Haxe
Plus your undef has to appear after the glcanvas.h include.

Luke Selman

unread,
Mar 16, 2016, 12:18:11 PM3/16/16
to haxe...@googlegroups.com
Yeah, okay, so adding it in the wrapper part instead of the binding part actually works. Just need to test now. Thanks.

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Ian Harrigan

unread,
Mar 16, 2016, 1:06:17 PM3/16/16
to Haxe
Yup, on windows you need to explicity undef the RegisterClass macro as hxcpp has its own RegisterClass function that clashes. Its used all over the rest of the hxWidgets lib btw - might have saved yourself some time ;)

Ian 

Hugh

unread,
Mar 16, 2016, 9:06:03 PM3/16/16
to Haxe
There is a "#undef RegisterClass" in the hxcpp include code, so you could try including windows.h (or the code that in turns include this) first, and then hxcpp.h later.

Hugh
Reply all
Reply to author
Forward
0 new messages