helloworld-刚开始学cocos2dx,编译错误,求助大神~

问题描述

刚开始学cocos2dx,编译错误,求助大神~

我新建了一个场景类SecondScene

//SecondScene.h
#ifndef SecondScene_H
#define SecondScene_H
#include "cocos2d.h"
#include "HelloWorldScene.h"
using namespace cocos2d;

class SecondScene :public CCLayer {
public:
static CCScene* scene();
virtual bool init();
CREATE_FUNC(SecondScene);
};
#endif

//SecondScene.cpp
#include "SecondScene.h"
CCScene* SecondScene::scene()
{
CCScene* scene = CCScene::create();
SecondScene* layer = SecondScene::create();
scene->addChild(layer);
return scene;
}
bool SecondScene::init()
{
CCLabelTTF* label = CCLabelTTF::create("Hahaha", "Arial", 40);
label->setPosition(ccp(200, 200));
this->addChild(label);
return true;
}

然后在HelloWorldScene.cpp的回调函数里用到:
void HelloWorld::menuCloseCallback(Ref* pSender)
{
//Director::getInstance()->end();
CCDirector::sharedDirector()->replaceScene(SecondScene::scene());
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}

可是编译出了错误,提示我:
“SecondScene”:不是类活命名空间的名称
“scene”:找不到标识符

就是这样,请问该怎么解决呀?

时间: 2024-09-17 03:28:21

helloworld-刚开始学cocos2dx,编译错误,求助大神~的相关文章

poj 1276 背包问题 编译错误 求大神看看 英汉题意如下

问题描述 poj 1276 背包问题 编译错误 求大神看看 英汉题意如下 Description A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, say Dk, k=

求助大神用c#实现分支定界法

问题描述 刚开始学C#,有没有大神可以教我用c#实现分支定界法,最好是200左右行代码,能有注释最好了 解决方案

c++-新手学C++求助大神,编译过了,运行错误搞不懂啊

问题描述 新手学C++求助大神,编译过了,运行错误搞不懂啊 #include using namespace std; struct Node { int data; Node *next; }; int count=0; Node *first; void creatList(int a[],int n) { Node *s,*r; r=first; for(int i=0;i { s=new Node; s->data=a[i]; r->next=s;r=s; } r->next=f

VB.NET项目运行流程怎么样的,本人是刚学VB.NET的,求助大神

问题描述 本人刚学VB.NET,刚知道基础的东西,现在开始接触项目,有完整的项目,但是找不到项目运行的入口,比如类似于Java中的主函数入口等等啊,求助大神啊 解决方案 解决方案二:vb不需要那个所以没有解决方案三:在项目中搜索submain解决方案四:vs中新建vb项目写入代码ctrl+f5编译运行解决方案五: 解决方案六:既然是刚学基础的东西,那么你学习的哪本入门书让你来找vb.net的入口函数呢?你试试回答这个问题,也许能有所启发.解决方案七:引用3楼devmiao的回复: vs中新建vb

求助大神帮我看下 下面的代码哪里有错 编译的时候一直报错

问题描述 求助大神帮我看下 下面的代码哪里有错 编译的时候一直报错 #include #include #pragma comment(lib, "Rasapi32.lib") //#include "Resource.h" HRASCONN hrasconn = NULL; //存放活动连接句柄, 用于断开连接 //BOOL WINAPI DlgProc(HWND,UINT,WPARAM,LPARAM); //BOOL RasEnum(HWND hwnd); //

刚学c语言向各位大神求救

问题描述 刚学c语言向各位大神求救 这个代码的m值当输入you are yourself时应该是15 但是奇怪的变成了19望各位大大帮我看看,不胜感激 源代码: #include #include int main() { int i,n=0,m; char A[100],B[100]; gets(A); m=strlen(A); for(i=0;i<=m-1;i++) { if(A[i]=='y'&&A[i+1]=='o'&&A[i+2]=='u'&&

代码-本人菜鸟,刚学qt,请各位大神指点

问题描述 本人菜鸟,刚学qt,请各位大神指点 请问为什么这个没有输出呢? while (!stream.atEnd()) { message +='n'+stream.readLine(); //逐行读取文本文件的数据 } qDebug()<<message;

c#pdf直接显示指...-新手学c#关于打开PDF格式文件的问题,求助大神解决

问题描述 新手学c#关于打开PDF格式文件的问题,求助大神解决 单击事件:system.Diagnostics.Process.Start("PDF文件的位置和文件名".PDF) 这个能不能实现打开PDF文件时,跳转到指定的页码?! 代码改怎么写? 解决方案 http://www.foxitsoftware.cn/products/reader/ foxit下载.介绍 关于命令行调用更多的文档 打开福昕阅读器,选择"帮助" > "命令行帮助"

求助大神!!!C#如何屏蔽引用他人的DLL中弹出的错误窗口?

问题描述 我引用了别人的DLL,报错的时候弹出了一个窗体,但这个错误对我没影响,我想不让这个窗体显示,该怎么做呢?求助大神 解决方案 解决方案二:try{}catch{什么也不做}