码迷,mamicode.com
首页 > 其他好文 > 详细

解决Cocos2d-x3.0、3.1 "_opendir$INODE64"symbol(s) not found错误

时间:2014-11-19 12:42:26      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:cocos2d-x   ios8   _opendirinode64   

升级系统和XCode后,在IOS8上编译之前的项目会报如下错误:

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)
原来苹果公司打算自己整一套OPenGL的东西,所有,有些东西需要根据IOS平台来加入它的东西。这个问题的解决方案如下:

在工程目录下cocos/platform/CCImage.cpp添加如下代码:

#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
参考文档:http://discuss.cocos2d-x.org/t/cocos2dx-with-ios-8-will-work/14621

https://github.com/cocos2d/cocos2d-x/pull/6986


解决Cocos2d-x3.0、3.1 "_opendir$INODE64"symbol(s) not found错误

标签:cocos2d-x   ios8   _opendirinode64   

原文地址:http://blog.csdn.net/yuxikuo_1/article/details/41278857

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!