欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

解决Xcode 6 beta 编译Cocos2d

程序员文章站 2022-06-09 20:53:44
...

在Xcode 6 beta里编译Cocos2d-x iOS项目时可能会失败,提示如下错误: Undefined symbols for architecture i386: _fwrite$UNIX2003, referenced from: _unixErrorHandler in libcocos2dx iOS.a(tif_unix.o) _unixWarningHandler in libcocos2dx iOS.a(tif_u

在Xcode 6 beta里编译Cocos2d-x iOS项目时可能会失败,提示如下错误:

Undefined symbols for architecture i386:

"_fwrite$UNIX2003", referenced from:

_unixErrorHandler in libcocos2dx iOS.a(tif_unix.o)

_unixWarningHandler in libcocos2dx iOS.a(tif_unix.o)

_empty_output_buffer in libcocos2dx iOS.a(jdatadst.o)

_term_destination in libcocos2dx iOS.a(jdatadst.o)

_Fax3PrintDir in libcocos2dx iOS.a(tif_fax3.o)

_PredictorPrintDir in libcocos2dx iOS.a(tif_predict.o)

"_strerror$UNIX2003", referenced from:

_TIFFOpen in libcocos2dx iOS.a(tif_unix.o)

ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)

如下图所示:

解决Xcode 6 beta 编译Cocos2d
解决方法很简单,只需要在AppDelegate.cpp中加入如下代码即可:

extern"C"{

size_t fwrite$UNIX2003( constvoid *a, size_t b, size_t c, FILE *d )

{

return fwrite(a, b, c, d);

}

char* strerror$UNIX2003( int errnum )

{

return strerror(errnum);

}

}