我正在关注教程 http://www.bit-101.com/blog/?p=2115.在本教程中,我找到了一个项目模板并通过它开始.
I am following the tutorial http://www.bit-101.com/blog/?p=2115. In this tutorial I found a project template and go through it to begin.
我已经下载了cocos2d-iphone-0.99.1 添加子目录cocos2d 进行项目......但是当我构建时,我得到了 9 个错误和 4 个警告
I have downloaded cocos2d-iphone-0.99.1 add the subdirectory cocos2d to project….but when I built I got 9 error and 4 warning
Scene.h:没有这样的文件或目录Director' undeclared (第一次使用在这个功能)/Volumes/Jobed/cocos2d/CCTexture2D.m:79:24:错误:FontManager.h:没有这样的文件或目录/Volumes/Jobed/cocos2d/CCTexture2D.m:80:35:错误:FontLabelStringDrawing.h:否这样的文件或目录/Volumes/Jobed/cocos2d/CCTexture2D.m:在函数'-[CCTexture2D(Text)initWithString:fontName:fontSize:]‘:/Volumes/Jobed/cocos2d/CCTexture2D.m:519:错误:ZFont"未声明(首次使用在这个函数中)/Volumes/Jobed/cocos2d/CCTexture2D.m:519:错误:(每个未声明的标识符都是只报过一次/Volumes/Jobed/cocos2d/CCTexture2D.m:519:错误:对于它出现的每个功能在.)/Volumes/Jobed/cocos2d/CCTexture2D.m:519:错误:zFont"未声明(首次使用在这个函数中)/Volumes/Jobed/cocos2d/CCTexture2D.m:519:错误:FontManager"未声明(首先在这个函数中使用)/Volumes/Jobed/cocos2d/CCTexture2D.m:521:警告:NSString"可能不会响应'-sizeWithZFont:'/Volumes/Jobed/cocos2d/CCTexture2D.m:521:警告:(没有匹配的消息方法签名/Volumes/Jobed/cocos2d/CCTexture2D.m:521:警告:将假定返回‘id’并接受/Volumes/Jobed/cocos2d/CCTexture2D.m:521:警告:……"作为参数.)/Volumes/Jobed/cocos2d/CCTexture2D.m:521:错误:不兼容的类型任务/Volumes/Jobed/cocos2d/CCTexture2D.m:在函数'-[CCTexture2D(Text)initWithString:dimensions:alignment:fontName:fontSize:]‘:/Volumes/Jobed/cocos2d/CCTexture2D.m:567:错误:FontManager"未声明(首先在这个函数中使用)/Volumes/Jobed/cocos2d/CCTexture2D.m:569:警告:NSString"可能不会响应'-drawInRect:withZFont:lineBreakMode:alignment:'
Scene.h: No such file or directory Director’ undeclared (first use in this function) /Volumes/Jobed/cocos2d/CCTexture2D.m:79:24: error: FontManager.h: No such file or directory /Volumes/Jobed/cocos2d/CCTexture2D.m:80:35: error: FontLabelStringDrawing.h: No such file or directory /Volumes/Jobed/cocos2d/CCTexture2D.m: In function ‘-[CCTexture2D(Text) initWithString:fontName:fontSize:]‘: /Volumes/Jobed/cocos2d/CCTexture2D.m:519: error: ‘ZFont’ undeclared (first use in this function) /Volumes/Jobed/cocos2d/CCTexture2D.m:519: error: (Each undeclared identifier is reported only once /Volumes/Jobed/cocos2d/CCTexture2D.m:519: error: for each function it appears in.) /Volumes/Jobed/cocos2d/CCTexture2D.m:519: error: ‘zFont’ undeclared (first use in this function) /Volumes/Jobed/cocos2d/CCTexture2D.m:519: error: ‘FontManager’ undeclared (first use in this function) /Volumes/Jobed/cocos2d/CCTexture2D.m:521: warning: ‘NSString’ may not respond to ‘-sizeWithZFont:’ /Volumes/Jobed/cocos2d/CCTexture2D.m:521: warning: (Messages without a matching method signature /Volumes/Jobed/cocos2d/CCTexture2D.m:521: warning: will be assumed to return ‘id’ and accept /Volumes/Jobed/cocos2d/CCTexture2D.m:521: warning: ‘…’ as arguments.) /Volumes/Jobed/cocos2d/CCTexture2D.m:521: error: incompatible types in assignment /Volumes/Jobed/cocos2d/CCTexture2D.m: In function ‘-[CCTexture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:]‘: /Volumes/Jobed/cocos2d/CCTexture2D.m:567: error: ‘FontManager’ undeclared (first use in this function) /Volumes/Jobed/cocos2d/CCTexture2D.m:569: warning: ‘NSString’ may not respond to ‘-drawInRect:withZFont:lineBreakMode:alignment:’
等等……为什么?
不久前 cocos2d 重命名了他们所有的类.它们现在都以 CC 开头.在上面的示例中,您应该使用 CCDirector.h,而不是 Director.h
A little while back cocos2d renamed all of their classes. They now all begin with CC. In your above example, you should be using CCDirector.h, not Director.h
看看 cocos2d API了解更多详情.
查看您发布的教程后,其中包含的信息似乎有点过时了.我想你会发现安装说明特别麻烦.我建议找一个更好的教程.cocos2d 网站上有几个贴子.这里是关于如何安装 cocos2d.
After looking at the tutorial you posted, it looks like the information contained within it is a little out of date. I think you'll find the installation instructions especially troublesome. I'd suggest finding a better tutorial. There are several posted on the cocos2d site. Here's a more up to date guide on how to install cocos2d.
我应该发布一个链接到 cocos2d 编程指南 直接.它包含您开始使用时需要了解的所有信息.
I should have posted a link to the cocos2d programming guide directly. It contains all the information you need to know to get started.
这篇关于cocos2d 错误:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!