Mixing c++ with objective-c - issue with SEL_MenuHandler was not declared in this scope

here’s a snippet:

-(void)showPersonalAd {
   cocos2d::CCMenuItemImage *adBanner = cocos2d::CCMenuItemImage::itemFromNormalImage("personalad.png", "personalad.png", self, menu_selector(openURLforAd));  
  // error SEL_MenuHandler was not declared in this scope
}

-(void)openURLforAd {
}

I get these specific errors:
testsAppDelegate.mm:165: error: ‘SEL_MenuHandler’ was not declared in this scope
AND
testsAppDelegate.mm:165: error: ‘openURLforAd’ was not declared in this scope

What is the proper way to call an objective-c function while using c++ function call? Is that totally illegal? If so, what would you recommend? I’m trying to implement AdWhirl iPhone SDK into this cocos2d-x project on the iOS side of the port.

Many thanks!

I think it’s because of you haven’t use the cocos2d namespace at the begin of the .mm file.
Try to add code like this:

using namespace cocos2d;

But I just find that you want to use a member function of an objective-c class as the callback of the menu. It will not work!
You only can use a member function of a C++ class to do it!

Hope it’s helpful!

Thanks for the advice. I have decided to stick with the c++ style here: http://www.cocos2d-x.org/boards/7/topics/1902
Thanks!