本文出自:http://blog.csdn.NET/hengshujiyi/article/details/21182813

补充:我出现这个错误是一个工程中有两个同名的文件,只要删除掉一个就好了,可能是从文件夹中倒文件是出现了重复导入的错误。

这种问题,通常出现在添加第三方库文件或者多人开发时。

这种问题一般是找不到文件而导致的链接错误。 我们可以从如下几个方面着手排查。

1.以如下错误为例,如果是多人开发,你同步完成后发现出现如下的错误。

  1. Undefined symbols for architecture armv7:
  2. "_OBJC_CLASS_$_MyPageLogViewController", referenced from:
  3. objc-class-ref in BaiduMobStatAppDelegate.o
  4. ld: symbol(s) not found for architecture armv7
  5. clang: error: linker command failed with exit code 1 (use -v to see invocation)

错误中出现了“MyPageLogViewController”这个类,你可以找到这个类的.m文件, 查看他的Target Membeship, 如下图

如果没有勾选上,点击勾选。然后编译查看。

2. 如果是新添加的第三方库,且不是静态库

先重复第一步过程,然后找到 Build settings->Linking->Other Linker Flags

将此属性修改成-all_load  或者 -ObjC ,这个视情况而定。总之可以多试几次。

3.如果添加的是第三方静态库(.a文件)

  1. Undefined symbols for architecture armv7:
  2. "_OBJC_CLASS_$_BaiduMobStat", referenced from:
  3. objc-class-ref in BaiduMobStatAppDelegate.o
  4. objc-class-ref in MyPageLogViewController.o
  5. (maybe you meant: _OBJC_CLASS_$_BaiduMobStatAppDelegate)
  6. ld: symbol(s) not found for architecture armv7
  7. clang: error: linker command failed with exit code 1 (use -v to see invocation)

在用到这个库的所有文件中都出现了错误, 如上 BaiduMobStatAppDelegate 类和 MyPageLogViewController类

这种情况就可能是这个静态库路径混乱导致的链接错误

解决方法:Build settings->Search Path->Library Search Paths  添加静态库的相应路径。如下图

如果上面的所有方法都不管用。你可以再试试一下几个方法:

1,看看是不是有新添加的文件跟之前文件同名

2,错误信息中出现了某个类的名字,去原文件中看看#import了哪些第三方库,把这些库挨个注释排除,找到出错的那个库,然后按照官方提供的步骤重新添加一遍。

iOS之出现( linker command failed with exit code 1)错误总结的更多相关文章

  1. 运行代码时报linker command failed with exit code 1 错误

    一个c语言项目,在.h文件中原来只有一些方法的声明,后来我加入了一些变量声明后,编译的时候报错: 运行代码时报linker command failed with exit code 1 错误 怎么回 ...

  2. iOS 报错: linker command failed with exit code 1 (use -v to see invocation) 原因

    在iOS开发中,很多人会遇到这样的报错 linker command failed with exit code 1 (use -v to see invocation) 可能的原因如下: 1.引用出 ...

  3. ios clang: error: linker command failed with exit code 1 (use -v to see invocation)解决方法

    当xcode编译时出现这个错误,一般是你的编译源码中存在重复的源码 解决方法:"Build Phases" -> "Compile Sources" 去删 ...

  4. [问题]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一

    今天添加了一个新类(包括m,h,xib文件),还没有调用,-编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...

  5. [报错]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一

    今天添加了一个新类(包括m,h,xib文件),还没有调用,—编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...

  6. IOS Bugs5 linker command failed with exit code 1 (use -v to see invocation)

    Ld /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/ ...

  7. iOS开发——打包报错error: linker command failed with exit code 1

    真机运行没问题,打包报错: clang: error: linker command failed with exit code 1 (use -v to see invocation) 原因:在Xc ...

  8. iOS报错:linker command failed with exit code 1 (use -v to see invocation) 问题解决方式之一

    百度库原版本:3.2.1  更新为:4.2.0,两个库相隔2年时间: 问题i: 更新CocoaPods的同时更新了百度地图库的版本,运行程序报错: linker command failed with ...

  9. iOS出现 _OBJC_CLASS_$_ZSHomeServiceDataElementGroupLargeImage", referenced from:以及linker command failed with exit code 1 (use -v to see invocation)的错误分析

    先说第一个问题 出现这样的错误我总结的原因有两个,我碰到过的: 1.文件重命名,在你创建文件的时候重名了 2.如果你是在一个类中又创建了一个或者多个类,那么你可能没有实现你写的类,也就是你只是@int ...

随机推荐

  1. 2017年10月22日 基础SQL语句&数据库创建主外键关系

    1.SQL语句的注释 双减号:-- 或者/**/2.创建数据库create database 数据库名称(不允许以数字开头,不允许以符号开头,不要起汉语名字) 3.如何选中这个数据库use 数据库名 ...

  2. TensorFlow入门:mac 安装 TensorFlow

    开发环境: mac os 10.12.5 Python 2.7.10 GCC 4.2.1 mac默认是不带pip的,安装pip. sudo easy_install pip 1.安装virtualen ...

  3. PAT 1021 Deepest Root

    #include <cstdio> #include <cstdlib> #include <vector> using namespace std; class ...

  4. H5新特性-----WebSocket

    WebSocket 是 HTML5 开始提供的一种在单个 TCP 连接上进行全双工通讯的协议. WebSocket 使得客户端和服务器之间的数据交换变得更加简单,允许服务端主动向客户端推送数据.在 W ...

  5. JavaScript中文拼音排序函数

    要对很多设备根据名称排序,找了找没有找到特别适合的,然后就自己写了一个根据中文拼音首字母排序的方法. github: https://github.com/haboll/sort.git

  6. android Viewpager取消预加载及Fragment方法的学习

    1.在使用ViewPager嵌套Fragment的时候,由于VIewPager的几个Adapter的设置来说,都会有一定的预加载.通过设置setOffscreenPageLimit(int numbe ...

  7. 关于 document.compatMode

    今天查资料时无意发现一个以前没有注意到过的属性:document.compatMode 经过一番资料的查询后,了解到以下信息: 我们都知道IE有两种盒子模型,在不声明 !DOCTYPE 时是混杂模式 ...

  8. 文件读取方法(FileHelpers) z

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using FileHelp ...

  9. Nginx+Tomcat+Session 高性能群集搭建

    随着IT行业的发展,linux服务器在企业中应用广泛,人们对linux上的应用服务要求也越来越高,早先的apache服务器.apache有优点也 有不足,apache渐渐不能满足人们的要求,目前ngi ...

  10. 数据结构与算法分析java——树2(二叉树类型)

    1. 二叉查找树 二叉查找树(Binary Search Tree)/  有序二叉树(ordered binary tree)/ 排序二叉树(sorted binary tree) 1). 若任意节点 ...