首页 > 代码库 > Cocos2d-x3.1 工程Xcode6编译时的问题
Cocos2d-x3.1 工程Xcode6编译时的问题
最近遇到的问题,是我同事找到的解决办法,这里记录一下
报错
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)
Undefined symbols for architecture x86_64: "_opendir$INODE64", referenced from: _OPENSSL_DIR_read in libcocos2dx iOS.a(o_dir.o) "_readdir$INODE64", referenced from: _OPENSSL_DIR_read in libcocos2dx iOS.a(o_dir.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决方案:
extern "C" { //新增代码 #if defined (__unix) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #ifndef __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ #define __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ #include <stdio.h> #include <dirent.h> FILE *fopen$UNIX2003( const char *filename, const char *mode ) { return fopen(filename, mode); } 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); } DIR *opendir$INODE64(const char * a) { return opendir(a); } struct dirent *readdir$INODE64(DIR *dir) { return readdir(dir); } #endif #endif //结束 #include "png.h" #include "tiffio.h" #include "base/etc1.h" #include "jpeglib.h" }
Cocos2d-x3.1 工程Xcode6编译时的问题
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。