您的位置:首页 > 移动开发 > Cocos引擎

error C2664: “void std::_Pmf_wrap<void (__thiscall cocos2d::Layer::* )(const std::vector<cocos2d::To

2015-03-28 22:27 741 查看
使用vs2013编写cocos2dx的代码:

          _touchListener = EventListenerTouchOneByOne::create();
_touchListener->setSwallowTouches(true);

_touchListener->onTouchBegan = CC_CALLBACK_2(HelloWorld::onTouchBegan, this);
_touchListener->onTouchMoved = CC_CALLBACK_2(HelloWorld::onTouchesMoved, this);
_touchListener->onTouchEnded = CC_CALLBACK_2(HelloWorld::onTouchEnded, this);
_touchListener->onTouchCancelled = CC_CALLBACK_2(HelloWorld::onTouchCancelled, this);

结果编译时报如下错误

error C2664: “void std::_Pmf_wrap<void (__thiscall cocos2d::Layer::* )(const std::vector<cocos2d::Touch *,std::allocator<_Ty>> &,cocos2d::Event *),void,cocos2d::Layer,const std::vector<_Ty,std::allocator<_Ty>> &,cocos2d::Event *>::operator ()(_Farg0 &,const
std::vector<_Ty,std::allocator<_Ty>> &,cocos2d::Event *) const”: 无法将参数 2 从“cocos2d::Touch *”转换为“const std::vector<cocos2d::Touch *,std::allocator<_Ty>> &”
d:\program files (x86)\microsoft visual studio 12.0\vc\include\functional
1149 1
GameCenter

从错误的意思看是说不能将cocos2d::Touch *转换为const std::vector<cocos2d::Touch *,std::allocator<_Ty>> &

最终发现是因为写错了函数,_touchListener->onTouchMoved = CC_CALLBACK_2(HelloWorld::onTouchesMoved, this);

这里将HelloWorld::onTouchMoved错写成了HelloWorld::onTouchesMoved,导致函数不匹配。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  cocos2dx vs2013 erro
相关文章推荐