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

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

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了哪些第三方库,把这些库挨个注释排除,找到出错的那个库,然后按照官方提供的步骤重新添加一遍。

连接常见错误linker command failed with exit code 1 (use -v to see invocation)的更多相关文章

  1. iOS真机测试碰到错误linker command failed with exit code 1 (use -v to see invocation)

    在模拟器上运行正常,但是在模拟器上就会报错,这是因为xocde7之后增加了一个bitcode,bitcode是被编译程序的一种中间形式的代码.包含bitcode配置的程序将会在App store上被编 ...

  2. iOS:编译错误 linker command failed with exit code 1 (use -v to see invocation)

    将project不加入.m要求加入 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzI0MzQ2OQ==/font/5a6L5L2T/fontsi ...

  3. iOS真机测试友盟碰到错误linker command failed with exit code 1 (use -v to see invocation) 百度地图的检索失败 sqlite 错误码

    因为友盟不支持bitcode 在模拟器上运行正常,但是在模拟器上就会报错,这是因为xocde7之后增加了一个bitcode,bitcode是被编译程序的一种中间形式的代 码.包含bitcode配置的程 ...

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

    背景:用U盘从另一台电脑考过来后,出现错误 linker command failed with exit code 1 (use -v to see invocation) 出现这种情况很可能是,项 ...

  5. 添加第三方类库造成的linker command failed with exit code 1 (use -v to see invocation)的错误调试

    linker command failed with exit code 1 (use -v to see invocation)这个错误貌似遇见并不止一次,当我想用某个第三方类库的时候(如SBJso ...

  6. linker command failed with exit code 1 (use -v to see invocation),经典Xcode编译错误的出现和解决!

    linker command failed with exit code 1 (use -v to see invocation)这个肯定是个xcode编译运行的时候经典的报错了. 这个问题曾经在我的 ...

  7. iOS cocoapods导入项目 出现 "___gxx_personality_v0", referenced from: 或者 clang: error: linker command failed with exit code 1 (use -v to see invocation) 错误

    今天想导入PNChart 编译的时候出现了  "___gxx_personality_v0", referenced from:  和 clang: error: linker c ...

  8. "_OBJC_CLASS_$_ALAssetsLibrary", referenced from:和clang: error: linker command failed with exit code 1 (use -v to see invocation)错误

    在项目中使用MWPhotoBrowser未导入ALAssetsLibrary类库时会导致编译时出现异常: "_OBJC_CLASS_$_ALAssetsLibrary", refe ...

  9. symbol(s) not found for architecture x86_64 之 linker command failed with exit code 1 (use -v to see invocation)解决方案排查

    这样的错误 ,我的解决方案是, 第一种:   查看他说在 ****.o 中,你要查看这样的关键点,然后去查看,你 项目中有没有引进这样的文件,在项目中查找,看项目中有没有,如果没有那就是没添加进来,你 ...

随机推荐

  1. C++利用宏实现变量交换的三种方式

    #include <iostream> using namespace std; //引入中间变量 #define SWAP1(a,b) {int tmp=a;a=b;b=tmp;} // ...

  2. Eclipse:批量将Java源代码文件的编码从GBK转为UTF-8

    很简单的几行代码,就可以批量将GBK格式的java文件转为UTF-8格式. 基本上所有文本文件的编码转换都可以采用这种方式. import java.io.File; import java.io.I ...

  3. ES6-字符串模板

    es6字符串模板 // es5 let ananiah = "大诶呀"; let blog = "我要忘了你的样子"+ ananiah; console.log ...

  4. Data Management Technology(1) -- Introduction

    1.Database concepts (1)Data & Information Information Is any kind of event that affects the stat ...

  5. ThinkPHP数据库驱动之mysql事物回滚

    1.开启事务方法 startTrans()2.事务提交方法 commit()3.事务回滚方法 rollback() 用法例子: $order = M(‘order’); $allAdded = tru ...

  6. acwing 528. 奶酪 解题记录

    习题地址 https://www.acwing.com/problem/content/description/530/ 现有一块大奶酪,它的高度为h,它的长度和宽度我们可以认为是无限大的,奶酪中间有 ...

  7. AcWing 32. 调整数组顺序使奇数位于偶数前面

    习题地址 https://www.acwing.com/solution/acwing/content/2921/ 输入一个整数数组,实现一个函数来调整该数组中数字的顺序. 使得所有的奇数位于数组的前 ...

  8. LeetCode 1245 树的直径

    地址 https://leetcode-cn.com/contest/biweekly-contest-12/problems/tree-diameter/ 给你这棵「无向树」,请你测算并返回它的「直 ...

  9. ASM与ASMD

    时序机 状态机 控制器 数据通路之间的关系 样例代码

  10. Educational Codeforces Round 76 (Rated for Div. 2) E. The Contest dp

    E. The Contest A team of three programmers is going to play a contest. The contest consists of