Skip to content

wrap is not a member of qjs::js_traits<MyCustomClass,void> #55

@projectitis

Description

@projectitis

Hi FTK,

I understand that this error is indicating something else is wrong somewhere.

I seem to get errors like this for any getters that return a DisplayObject*, so I'm guessing my error is in my qjs code for DisplayObject somewhere. When I comment out the lines that appear to be the issue, similar build errors occur just with other parts of the code.

Any idea why these errors would usually occur? What sort of problems should I be looking for in my code?

My code looks something like this (these are just snippets of what is in Script.cpp):

// Dispatcher
module.class_<Dispatcher>( "Dispatcher" )
	.constructor<>()
	.fun<&Dispatcher::dispatch>( "dispatch" )
	.fun<&Dispatcher::listen>( "listen" )
	.fun<&Dispatcher::remove>( "remove" )
	.fun<&Dispatcher::clear>( "clear" );

// Display object
typedef HitArea*( DisplayObject::* DisplayObject_getHitAreaF )( void );
typedef void( DisplayObject::* DisplayObject_setHitAreaF )( HitArea* );
module.class_<DisplayObject>("DisplayObject")
	.base<Dispatcher>()
	.constructor<>()
	.property<&DisplayObject::parent>( "parent" )
	.property<&DisplayObject::numChildren>( "numChildren" )
	.property<&DisplayObject::first>( "first" )
	.property<&DisplayObject::last>( "last" )
	.property<&DisplayObject::first>( "next" )
	.property<&DisplayObject::last>( "prev" )
	.property<(DisplayObject_getHitAreaF)&DisplayObject::hitArea, (DisplayObject_setHitAreaF)&DisplayObject::hitArea>( "hitArea" )
	.fun<&DisplayObject::x>( "x" )
	.fun<&DisplayObject::y>( "y" )
	.fun<&DisplayObject::width>( "width" )
	.fun<&DisplayObject::height>( "height" )
	.fun<&DisplayObject::scaleX>( "scaleX" )
	.fun<&DisplayObject::scaleY>( "scaleY" )
	.fun<&DisplayObject::rotation>( "rotation" )
	.fun<&DisplayObject::originX>( "originX" )
	.fun<&DisplayObject::originY>( "originY" )
	.fun<&DisplayObject::visible>( "visible" )
	.fun<&DisplayObject::alpha>( "alpha" )
	.fun<&DisplayObject::mouse>( "mouse" )
	.fun<&DisplayObject::addChild>( "addChild" )
	.fun<&DisplayObject::addChildAt>( "addChildAt" )
	.fun<&DisplayObject::removeChild>( "removeChild" )
	.fun<&DisplayObject::removeChildAt>( "removeChildAt" )
	.fun<&DisplayObject::removeAllChildren>( "removeAllChildren" )
	.fun<&DisplayObject::childAt>( "childAt" )
	.fun<&DisplayObject::indexOfChild>( "indexOfChild" )
	.fun<&DisplayObject::addBefore>( "addBefore" )
	.fun<&DisplayObject::addAfter>( "addAfter" )
	.fun<&DisplayObject::remove>( "remove" );

// Player
typedef int( Player::* Player_getIntF )( );
typedef void( Player::* Player_setIntF )( int );
typedef colorARGB( Player::* Player_getColorARGBF )( );
typedef void( Player::* Player_setColorARGBF )(colorARGB);
module.class_<Player>("Player")
	.constructor<int, int, string, bool>()
	.property<&Player::stage>("stage") // Get
	.property<(Player_getIntF)&Player::displayMode, (Player_setIntF)&Player::displayMode>("displayMode")
	.property<(Player_getIntF)&Player::scaleMode, (Player_setIntF)&Player::scaleMode>("scaleMode")
	.property<(Player_getIntF)&Player::alignMode, (Player_setIntF)&Player::alignMode>("alignMode")
	.property<(Player_getColorARGBF)&Player::backgroundColor, (Player_setColorARGBF)&Player::backgroundColor>("backgroundColor")
	.property<(Player_getColorARGBF)&Player::letterboxColor, (Player_setColorARGBF)&Player::letterboxColor>("letterboxColor")
	.fun<&Player::run>("run");

And the errors I get are like this:

1>Script.cpp
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(622,48): error C2039: 'wrap': is not a member of 'qjs::js_traits<derive::display::DisplayObject *,void>'
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(622): message : see declaration of 'qjs::js_traits<derive::display::DisplayObject *,void>'
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(703): message : see reference to function template instantiation 'JSValue qjs::detail::wrap_this_call<R,qjs::shared_ptr<T>,,derive::display::DisplayObject*(__cdecl derive::Player::* )(void)>(JSContext *,Callable &&,JSValue,int,JSValue *) noexcept' being compiled
1>        with
1>        [
1>            R=derive::display::DisplayObject *,
1>            T=derive::Player,
1>            Callable=derive::display::DisplayObject *(__cdecl derive::Player::* )(void)
1>        ]
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(703): message : while compiling class template member function 'JSValue qjs::js_traits<fgetter,void>::wrap(JSContext *,qjs::fwrapper<derive::display::DisplayObject *derive::Player::stage(void),true>) noexcept'
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(1130): message : see reference to function template instantiation 'JSValue qjs::js_traits<fgetter,void>::wrap(JSContext *,qjs::fwrapper<derive::display::DisplayObject *derive::Player::stage(void),true>) noexcept' being compiled
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(1131): message : see reference to class template instantiation 'qjs::js_traits<fgetter,void>' being compiled
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(1701): message : see reference to function template instantiation 'qjs::Value &qjs::Value::add_getter<derive::display::DisplayObject *derive::Player::stage(void)>(const char *)' being compiled
1>C:\Projects\derive\derive\src\Script.cpp(368): message : see reference to function template instantiation 'qjs::Context::Module::class_registrar<derive::Player> &qjs::Context::Module::class_registrar<derive::Player>::property<derive::display::DisplayObject *derive::Player::stage(void),nullptr>(const char *)' being compiled
1>C:\Projects\derive\derive\src\Script.cpp(374): message : see reference to function template instantiation 'qjs::Context::Module::class_registrar<derive::Player> &qjs::Context::Module::class_registrar<derive::Player>::property<derive::display::DisplayObject *derive::Player::stage(void),nullptr>(const char *)' being compiled
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(611,1): error C3861: 'wrap': identifier not found
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(622,48): error C2039: 'wrap': is not a member of 'qjs::js_traits<derive::geom::HitArea *,void>'
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(622): message : see declaration of 'qjs::js_traits<derive::geom::HitArea *,void>'
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(703): message : see reference to function template instantiation 'JSValue qjs::detail::wrap_this_call<R,qjs::shared_ptr<T>,,DisplayObject_getHitAreaF>(JSContext *,Callable &&,JSValue,int,JSValue *) noexcept' being compiled
1>        with
1>        [
1>            R=derive::geom::HitArea *,
1>            T=derive::display::DisplayObject,
1>            Callable=DisplayObject_getHitAreaF
1>        ]
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(703): message : while compiling class template member function 'JSValue qjs::js_traits<fgetter,void>::wrap(JSContext *,qjs::fwrapper<{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{216,{flat}}' }',0},true>) noexcept'
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(1113): message : see reference to function template instantiation 'JSValue qjs::js_traits<fgetter,void>::wrap(JSContext *,qjs::fwrapper<{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{216,{flat}}' }',0},true>) noexcept' being compiled
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(1114): message : see reference to class template instantiation 'qjs::js_traits<fgetter,void>' being compiled
1>C:\Projects\derive\dependencies\quickjspp\quickjspp.hpp(1703): message : see reference to function template instantiation 'qjs::Value &qjs::Value::add_getter_setter<{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{216,{flat}}' }',0},{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{208,{flat}}' }',0}>(const char *)' being compiled
1>C:\Projects\derive\derive\src\Script.cpp(310): message : see reference to function template instantiation 'qjs::Context::Module::class_registrar<derive::display::DisplayObject> &qjs::Context::Module::class_registrar<derive::display::DisplayObject>::property<{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{216,{flat}}' }',0},{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{208,{flat}}' }',0}>(const char *)' being compiled
1>C:\Projects\derive\derive\src\Script.cpp(332): message : see reference to function template instantiation 'qjs::Context::Module::class_registrar<derive::display::DisplayObject> &qjs::Context::Module::class_registrar<derive::display::DisplayObject>::property<{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{216,{flat}}' }',0},{&derive::display::DisplayObject::[thunk]: __cdecl derive::display::DisplayObject::`vcall'{208,{flat}}' }',0}>(const char *)' being compiled
1>main.cpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions