美文网首页iOS学习HTML5 专栏
iOS 报错 Undefined symbols for arc

iOS 报错 Undefined symbols for arc

作者: 石虎132 | 来源:发表于2018-01-16 10:10 被阅读122次

    //联系人:石虎 QQ:1224614774 昵称:嗡嘛呢叭咪哄

    一、报错详情

    Undefined symbols for architecture x86_64:

    "_OBJC_CLASS_$_Person", referenced from:

    _OBJC_CLASS_$_Dog in Dog.o

    objc-class-ref in ViewController.o

    "_OBJC_METACLASS_$_Person", referenced from:

    _OBJC_METACLASS_$_Dog in Dog.o

    ld: symbol(s) not found for architecture x86_64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    二、解决方法

    图1:

    图2:在 build Phases 下操作如下

    图3:添加类文件

    图4:编译成功

    三、造成 bug 原因,以及如何避免

    1.造成 bug 原因是其它类没有参加编译造成的,这种原因又分成二种

    2.如何避免

    第一种:此框一定要勾选

    第二种:此框一定要勾选

    注意:如果忘记勾选,就在项目中的 Build Phases 中的 Compile Sources 中添加(详细前看图4)

    谢谢!!!

    相关文章

      网友评论

        本文标题:iOS 报错 Undefined symbols for arc

        本文链接:https://www.haomeiwen.com/subject/hmzjoxtx.html