新手刚学习cocos2d关于点击回调问题

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"
#include "cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"

using namespace cocos2d;


class HelloWorld : public cocos2d::Layer
{
public:
    // there's no 'id' in cpp, so we recommend returning the class instance pointer
    static cocos2d::Scene* createScene();

    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();
    void menuCloseCallback(cocos2d::Ref* pSender){};
     // implement the "static create()" method manually
    CREATE_FUNC(HelloWorld);
private :
};

#endif // __HELLOWORLD_SCENE_H__



```

#include "HelloWorldScene.h"

USING_NS_CC;

using namespace cocostudio;
using namespace cocos2d::ui;



Scene* HelloWorld::createScene()
{
    auto scene = Scene::create();
    
    auto layer = HelloWorld::create();

    scene->addChild(layer);

    // return the scene
    return scene;
}

bool HelloWorld::init()
{
    if ( !Layer::init() )
    {
        return false;
    }
    
    auto rootNode = CSLoader::createNode("MainScene.csb");

    auto b = (Button*)rootNode->getChildByName("Button_1");

    b->addTouchEventListener( this,toucheventselector(HelloWorld::menuCloseCallback));
    
    b->setPosition(Point(64.00,906.00));
    addChild(rootNode);
    return true;
}

void menuCloseCallback(cocos2d::Ref* pSender)
{
    CCLOG("------------------");
}



```

小弟刚学习cocos2d,请大神指教下,我为啥会出错啊。实在没想通
错误提示是
0x07210B68 处的第一机会异常(在 Test.exe 中): 0xC0000005: 执行位置 0x07210B68 时发生访问冲突。
0x07210B68 处有未经处理的异常(在 Test.exe 中): 0xC0000005: 执行位置 0x07210B68 时发生访问冲突。

rootNode 与 b 是不是有NULL

没有把。我不点击button不会出错,只有点击才会出错。也就是说,我的错误应该出现在点击时。

看下崩溃的调用栈吧

button的回调函数有问题吧,应该是两个参数吧
typedef void (Ref::SEL_TouchEvent)(Ref,TouchEventType);
#define toucheventselector(_SELECTOR) (SEL_TouchEvent)(&_SELECTOR)