触摸事件究竟如何实现?

刚入门cocos2dx,最近遇到一个问题,就是声明总是显示语法错误,实在弄不懂,求大神指点一下。
函数声明:
bool onTouchesBegan(const std::vector<Touch*>& touches, Event * event);

void onTouchesEnded(const std::vector<Touch*>& touches, Event * event);

//触摸打开

this->setTouchEnabled(true);

    
auto dispatcher = Director::getInstance()->getEventDispatcher();
    
auto listener1 = EventListenerTouchAllAtOnce::create();

listener1->onTouchesBegan = CC_CALLBACK_2(HelloWorld::onTouchesBegan, this);
    
listener1->onTouchesEnded = CC_CALLBACK_2(HelloWorld::onTouchesEnded, this);
    
dispatcher->addEventListenerWithSceneGraphPriority(listener1, this);



    






//触摸效果函数
bool HelloWorld::onTouchesBegan(const std::vector& touches, Event *event)
{
    return true;
}


void HelloWorld::onTouchesEnded(const std::vector& touches, Event *event)
{
    CCTouch* touch = (CCTouch*)touches->anyObject();
    CCPoint locInView = touch -> getLocationInView();
    CCPoint loc = Director::getInstance()->convertToUI(locInView);
    
    
//子弹距离和速度计算公式

    if (loc.x <= 20)
    {
        return;
    }

    
    CCSize screenSize = CCDirector::sharedDirector()->getVisibleSize();
    CCSprite* proj = CCSprite::create("projectile.png");
    proj->setPosition(20, screenSize.height / 2.0);
    this->addChild(proj);



    double dx = loc.x - 20;
    double dy = loc.y - screenSize.height / 2.0;
    double d = sqrt(dx * dx + dy * dy);

    double D = sqrt(screenSize.width * screenSize.width + screenSize.height * screenSize.height);

    double ratio = D / d;
    double endx = ratio * dx + 20;
    double endy = ratio * dy + screenSize.height / 2.0;

    CCMoveTo* move = CCMoveTo::create(D / 320, ccp(endx, endy));
    CCCallFuncN* moveFinish = CCCallFuncN::create(this, callfuncN_selector(HelloWorld::myDefine));
    CCSequence* actions = CCSequence::create(move,moveFinish,NULL);
    proj->runAction(actions);
}



```


恳求大神过目和解答,谢谢

onTouchBegin

试过了,也不行,同样的错误,说是语法错误
void onTouchBegan(Touch* touch,Event* event)

bool onTouchBegan(Touch* touch,Event* event)

单点触摸:
` /* 单点触摸事件 */

// 创建一个怪物
auto guaiwu = Sprite::create("res/tk.png");
guaiwu->setPosition(Point(200,200));
this->addChild(guaiwu);


auto listener = EventListenerTouchOneByOne::create();

// 触摸键开始,当手指按下,怪物移动到点击的坐标位置
listener->onTouchBegan = [](Touch* touch, Event* event){

    
    // 获取单击坐标,基于3d
    // touch->getLocation();
    
    // 获取单击坐标,基于2d
    // touch->getLocationInView();
    
    // 获取单击坐标,基于Cocos2d-x
    //Director::getInstance()->convertToGL(<#const cocos2d::Vec2 &point#>)
    
    
    
    // 将2d坐标转换成cocos2d-x坐标
    Point point = Director::getInstance()->convertToGL( touch->getLocationInView() );
    
    // 创建移动对象,并将移动位置设置为当前点击的坐标
    auto moveTo  = MoveTo::create(0.3f, Point(point.x,point.y));
  
    // 取出注册监听时间时所绑定的node对象
    auto target = static_cast<Sprite*>(event->getCurrentTarget());
   
    // 开始移动
    target->runAction(moveTo);
    
    return true;
};


// 触摸滑动事件,当手指在屏幕上滑动
listener->onTouchMoved = [](Touch * touch, Event * event){

`

多点触摸:
`
Size visibleSize = Director::getInstance()->getVisibleSize();
auto label = Label::createWithSystemFont(“多点触摸demo”, “”, 24);
label->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));
this->addChild(label,1,100);
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesBegan = [&](const std::vector<Touch*>& touchs, Event* event) {

    auto label1 = (Label*) this->getChildByTag(100);
    
    
    for (auto &touch: touchs) {
        
        auto finger = touch->getID() + 1;
        label1->setString( "按下去"+Value(finger).asString() + "根手指^^");
    }
    
    
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);

`