搜索
您的当前位置:首页正文

解决Xcode6beta编译Cocos2d

2020-11-09 来源:欧得旅游网

在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)

如下图所示:


解决方法很简单,只需要在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);

}

}

Top