Home > Database > Mysql Tutorial > 语法错误: 标识符CCTouch的解决方法 cocos2dx

语法错误: 标识符CCTouch的解决方法 cocos2dx

WBOY
Release: 2016-06-07 15:09:36
Original
1557 people have browsed it

在写cocos2dx的我们常常需要用到ccTouchBegan、ccTouchMoved、ccTouchEnded,这几个函数。 用于实现自定义一些个性化的需求很是方便! setTouchEnabled(true); 虚函数声明: virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent); virtual void ccT

在写cocos2dx的我们常常需要用到ccTouchBegan、ccTouchMoved、ccTouchEnded,这几个函数。

用于实现自定义一些个性化的需求很是方便!

setTouchEnabled(true);

虚函数声明:

virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);

virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent);

有时候编译时错误提示如下:

error  语法错误: 标识符“CCTouch”

解决方法:在.h文件中加入头文件和命名空间如下:

#include "cocos2d.h"
USING_NS_CC; //使用cocos2d命名空间 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template