Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/160.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何在as函数参数Cocos2dx中使用SEL_MenuHandler/menu_处理程序?_C++_C++11_Cocos2d X - Fatal编程技术网

C++ 如何在as函数参数Cocos2dx中使用SEL_MenuHandler/menu_处理程序?

C++ 如何在as函数参数Cocos2dx中使用SEL_MenuHandler/menu_处理程序?,c++,c++11,cocos2d-x,C++,C++11,Cocos2d X,我使用cocos2dx构建了一个游戏 在v2.x版本中,我使用了: void Popup::addButtonWithText(const char* text, CCObject* target, SEL_MenuHandler selector) void Popup::addButtonWithText(const char* text,

我使用cocos2dx构建了一个游戏

在v2.x版本中,我使用了:

void Popup::addButtonWithText(const char* text, 
                              CCObject* target, 
                              SEL_MenuHandler selector)
void Popup::addButtonWithText(const char* text, 
                              Object* target, 
                              SEL_MenuHandler selector)
在使用弹出对象时,我将其用作:

popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
现在在V3.1.1中,我使用的是:

void Popup::addButtonWithText(const char* text, 
                              CCObject* target, 
                              SEL_MenuHandler selector)
void Popup::addButtonWithText(const char* text, 
                              Object* target, 
                              SEL_MenuHandler selector)
在使用弹出对象时,我将其用作:

popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
popup->addButtonWithText("TEXT", this, menu_selector(Class::FunctionName));
但在V3.1.1中,我得到了一个错误:

Static_cast from void to cocos2d::SEL_MenuHandler is not allowed

我也在做同样的事情,为什么会出现这个错误?

请参考最近关于这个主题的讨论: