Error at CC_CALLBACK_2 when build with release mode

Hello guys! I I’m not getting an error and it’s working when I build with debug mode.But I getting error when I build with release mode. at this line squareButton->addTouchEventListener(CC_CALLBACK_2(MainScene::squareButtonTouched, this));
How can I solve it?

Hi!
That the error?
What cocos2d version?

I’m using cocos2dx v3.17
error:
Error after macro substitution: Parameter type mismatch: Class ‘std::__bind<bool (MainScene::*)(Touch *,Event *), MainScene *, const std::placeholders::__ph<1> &, const std::placeholders::__ph<2> &>’ is not compatible with EventListenerTouchOneByOne::ccTouchBeganCallback

Can anyone help me?

Your method returns bool but have to return void.

1 Like