【新手问】包含头文件后依然找不到类

luo4188 2014-04-19 08:09:58
在 HelloWorldScene.h 中已经包含了cocos2d.h
但是依然找不到其中定义的类CCSprite,求助!
代码如下:

//HelloWorldScene.h

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#pragma once
#include "cocos2d.h"
#include "Box2D\Box2D.h"

#define RATIO 48.0f

class HelloWorld : public cocos2d::CCLayer
{
public:
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();

// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::CCScene* scene();

// a selector callback
void menuCloseCallback(CCObject* pSender);

// implement the "static node()" method manually
CREATE_FUNC(HelloWorld);
class cocos2d;
b2World * world;

CCSprite * Bird;//-------------------------------Error!!

CCSize screenSize;//-------------------------------Error!!
virtual void update(float dt);

private:
void addBird();
void initWorld();

};

#endif // __HELLOWORLD_SCENE_H__

错误信息如下

1>d:\information science\cocos2d-x-2.2.3\cocos2d-x-2.2.3\projects\flappybao\classes\helloworldscene.h(27): error C2143: syntax error : missing ';' before '*'
1>d:\information science\cocos2d-x-2.2.3\cocos2d-x-2.2.3\projects\flappybao\classes\helloworldscene.h(27): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\information science\cocos2d-x-2.2.3\cocos2d-x-2.2.3\projects\flappybao\classes\helloworldscene.h(30): error C2146: syntax error : missing ';' before identifier 'screenSize'
1>d:\information science\cocos2d-x-2.2.3\cocos2d-x-2.2.3\projects\flappybao\classes\helloworldscene.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


求助!谢谢!
...全文
282 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zxx178239 2014-04-19
  • 打赏
  • 举报
回复
命名空间USING_NS_CC;好像是这个
饭凉凉 2014-04-19
  • 打赏
  • 举报
回复
把文件夹下的ncb后缀的文件删了。重新打开试试。

65,187

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧