关于《无法从“void (__thiscall HelloWorld::* )(void)”转换为“cocos2d::SEL_MenuHandler”》的修改
2013-11-15 22:55
585 查看
废话就不多说了,先把错的代码贴上:
![](https://img-blog.csdn.net/20131115223402406?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMDcxMDc1OA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
之所以出错,是因为backMenu函数里没有加CCObject* pSender参数,这个参数传入的就是菜单,我们知道menu_selector回调函数选择器是SEL_MenuHandler类型的,下面是SEL_MenuHandler的定义:
typedef void (CCObject::*SEL_MenuHandler)(CCObject*);
![](https://img-blog.csdn.net/20131115223805937?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMDcxMDc1OA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
![](https://img-blog.csdn.net/20131115223453796?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMDcxMDc1OA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
添加完CCObject* pSender这个参数就顺利运行了。
之所以出错,是因为backMenu函数里没有加CCObject* pSender参数,这个参数传入的就是菜单,我们知道menu_selector回调函数选择器是SEL_MenuHandler类型的,下面是SEL_MenuHandler的定义:
typedef void (CCObject::*SEL_MenuHandler)(CCObject*);
添加完CCObject* pSender这个参数就顺利运行了。
相关文章推荐
- cocos2dx 无法从“void (__thiscall MyClass::* )(cocos2d::CCNode *)”转换为“cocos2d::SEL_MenuHandler”
- 错误 1 error C2440:“类型转换”: 无法从“void (__thiscall GameLayer::* )(cocos2d::CCObject *)”转换为“cocos2d::SEL_C
- cocos2d-x编译问题集合 error C2440: “类型转换”: 无法从“void (__thiscall xx::* )(void)”转换为“cocos2d::SEL_CallFuncN”
- 无法从“void (__thiscall XXX::* )(void)”转换为“cocos2d::SEL_SCHEDUL 错误总结
- 【cocos2dx】无法从“void (__thiscall xx::* )(void)”转换为“cocos2d::SEL_SCHEDULE”
- cocos2dx编译错误:无法从“void (__thiscall xx::* )(void)”转换为“cocos2d::SEL_CallFuncN”
- cocos2d-x编译问题集合之error C2440: “类型转换”: 无法从“void (__thiscall ::* )(void)”转换为“
- cocos2d-x3.2中error C2440: “类型转换”: 无法从“void (__thiscall xx::* )(void)”转换为
- cocos2d-x编译问题集合之error C2440: “类型转换”: 无法从“void (__thiscall ::* )(void)”转换为“
- cocos2d-x编译问题集合之error C2440: “类型转换”: 无法从“void (__thiscall ::* )(void)”转换为“
- 错误 4 error C2440: “static_cast”: 无法从“void (__thiscall HelloWorld::*
- cocos2d-x编译问题集合之error C2440: “类型转换”: 无法从“void (__thiscall ::* )(void)”转换为“
- cocos2d-x编译问题集合之error C2440: “类型转换”: 无法从“void (__thiscall ::* )(void)”转换为“
- cocos2d-x 编译问题集合之error C2440: “类型转换”: 无法从“void (__thiscall ::* )(void)”转换为“
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall
- 无法从“void (__thiscall CtestDlg::* )(void)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)”
- 【转】error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARAM,LPARAM)”
- error C2440 “static_cast” 无法从“void (__thiscall CPppView )(void)”转换为“LRESULT (__thiscall CWnd )(WPARA
- error C2440: “static_cast”: 无法从“void (__thiscall CXPButton::* )(WPARAM,LPARAM)”转换为“LRESULT (__thisca