iphone - cocos2d错误: No such file or directory

标签 iphone objective-c cocos2d-iphone

我正在关注教程http://www.bit-101.com/blog/?p=2115 。在本教程中,我找到了一个项目模板并通过它开始。

我已经下载了cocos2d-iphone-0.99.1 添加子目录 cocos2d 到项目......但是当我构建时我收到 9 个错误和 4 个警告

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

看看 cocos2d API了解更多详情。

查看您发布的教程后,看起来其中包含的信息有点过时了。我想你会发现安装说明特别麻烦。我建议寻找更好的教程。 cocos2d 网站上发布了几个。 Here's有关如何安装 cocos2d 的最新指南。

编辑:我应该发布一个指向 cocos2d programming guide 的链接直接地。它包含您开始使用时需要了解的所有信息。

关于iphone - cocos2d错误: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3359551/

相关文章:

ios - 为什么我的 tableview 直到第二次触摸才调用 didselectrowatindexpath?

ios - Cocos2D/iOS7 : continuously increasing memory usage for boilerplate code

objective-c - Cocos2dv3 : Renaming project causes Objective Chipmunk to not be found

iphone - UINavigationController 拦截 – popViewControllerAnimated :

iphone - 字符串操作

objective-c - iOS 13 上 TableView 错误的 Diffable 数据源 : Inconsistent associations for moves

ios - 如何在 cocos2d 中创建带编号的有序文本?

iphone - 缩放时 UIView 未检测到触摸

iphone - UITextView背景图片

objective-c - 在 Swift 2.0 中调用 checkResourceIsReachableAndReturnError