它无法编译源代码并显示以下信息:
Undefined symbols for architecture i386:
"_CTFontManagerRegisterFontsForURL",引用自: -[CCLabelTTF getFontName:] in CCLabelTTF.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
但是,当我将CCLabelTTF中以下函数中的所有代码替换为“return nil”时:
- (NSString*) getFontName:(NSString*)fontName
{
// Custom .ttf file ?
if ([[fontName lowercaseString] hasSuffix:@".ttf"])
{
// This is a file, register font with font manager
NSString* fontFile = [[CCFileUtils sharedFileUtils] fullPathForFilename:fontName];
NSURL* fontURL = [NSURL fileURLWithPath:fontFile];
CTFontManagerRegisterFontsForURL((CFURLRef)fontURL, kCTFontManagerScopeProcess, NULL);
return [[fontFile lastPathComponent] stringByDeletingPathExtension];
}
return fontName;
}
我可以编译我的代码,但无法使用标签。
那么如何解决这个问题而不需要创建一个新项目并将所有源代码复制到其中?
编辑
之前的版本是2.x,现在我有最新的rc2版本。
我删除了旧库中的所有文件,将新库中的文件复制到项目文件夹中,并通过xcode将它们添加到项目中。xcode可以使用新库文件创建项目,因此我从这个新项目中获取它们。然后我做了一些更改以消除警告。