開發的項目多了,對於一個i386的錯誤,處理起來應該是駕輕就熟的,但是仔細看來,跟以前遇到i386的錯誤還不大同樣,直接搜i386是搜不到該問題解決的方法,你要是搜「Undefined symbols for architecture i386」會搜出一些答案,但也不是不少,而且能不能解決當前遇到的問題,還得本身試事後才知道行仍是不行。這裏我就給你們說一下我當時搜到的一些解決方法:html
#ifdef DEBUG FILE *fopen$UNIX2003(const char *filename, const char *mode); size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream); #endif
再在AppDelegate.m文件中添加以下代碼:c++
#ifdef DEBUG FILE *fopen$UNIX2003(const char *filename, const char *mode) { return fopen(filename, mode); } size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream) { return fwrite(ptr, size, nitems, stream); } #endif
#if defined (__unix) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #ifndef __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ #define __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ FILE *fopen$UNIX2003(const char *filename, const char *mode); size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream); #endif #endif
再在AppDelegate.m文件中添加以下代碼:ui
#if defined (__unix) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #ifndef __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ #define __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ FILE *fopen$UNIX2003(const char *filename, const char *mode) { return fopen(filename, mode); } size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream) { return fwrite(ptr, size, nitems, stream); } #endif #endif