您的位置:首页 > 其它

“CCScale9Sprite”: 未声明的标识符 或“CCScale9Sprite”: 不是类或命名空间名称

2014-07-23 22:40 337 查看
今天遇到这个问题,想要测试一下CCControlButton这个类,但是VS2010老是报“CCScale9Sprite”: 未声明的标识符 “CCScale9Sprite”: 不是类或命名空间名称这类的错误,VS2010中的测试代码如下:

CCScale9Sprite *btnNormal = CCScale9Sprite::create("HelloWorld.png");
CCScale9Sprite *btnDown = CCScale9Sprite::create("HelloWorld.png");
CCLabelTTF *title = CCLabelTTF::create("Touch Me!3324234", "Marker Felt", 30);
CCControlButton* controlBtn = CCControlButton::create(title, btnNormal);
controlBtn->setBackgroundSpriteForState(btnDown, CCControlStateSelected);
controlBtn->setPosition(ccp(200, 200));
this->addChild(controlBtn)


1. 展开Debug|Win32 -> 双击Microsoft.Cpp.Win32.user -> VC++目录-> 包含目录 ->编辑添加 extensions到include中

2. 在属性->链接器->添加libExtensions.lib这个库文件

3. 在源文件中添加头文件 #include "costex.h"

4. 再添加 using namespace cocos2d::extensions; (有的版本可能是extension)

这样上面的错误就可能清除了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐