解决Xcode 6 编译Cocos2d-x iOS项目失败

在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( const void *a, size_t b, size_t c, FILE *d )

    {

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

    }

    char* strerror$UNIX2003( int errnum )

    {

        return strerror(errnum);

    }

}

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。