CCMenuItemImage menu_selector issue

I am trying to create a new CCMenu and CCMenuItemImage I have done this before in classes that extend CCLayer

But I am in a class that is extension of CCNode and I am getting an error:

@ cocos2d::CCMenuItemImage *pHUDCloseItem = cocos2d::CCMenuItemImage::create(
“close.png”,
“close.png”,
this,
menu_selector(GameScene::menuCloseHUDCallback));
@

The error is:

@ Unknown type name ‘SEL_MenuHandler’; did you mean ‘cocos2d::SEL_MenuHandler’?@

Can anyone help me understand my mistake?

I’ve managed to get rid of all “using” directives in my code except menu_selector. It’s defined in CCObject and need namespace to work. It could be maybe fixed with pull request to the guys, meantime you may use using namespace cocos2d; at begin of the method.

Thanks for the reply.

Specifically specifying using namespace cocos2d; works.

Also, I found a page that says to do something like this also

pHUDCloseItem = cocos2d::CCMenuItemImage::create("close.png", "close.png", this, (cocos2d::SEL_MenuHandler) &FieldLayer::menuCloseHUDCallback);

Wow, that is the job! :slight_smile: Tnx!