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

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

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. 在线程中显示一个窗口(多个UI线程)

    多数耗时操作可以异步执行,推荐async/await. 但和UI相关的部分仅能在UI线程执行,这时UI线程的耗时操作,导致界面卡死,不够友好. 我们可以创建一个单独的UI线程显示一个正在加载的窗口,可 ...

  2. python assert断言用法

    作用:断言函数运行状态 语法:assert condition,判断condition运行状态,若condition状态为false,则上报错误:AssertionError

  3. MAC 软件提示已损坏,需要移到废纸篓的解决方法

    解决方法一: 允许任何来源的应用.在系统偏好设置里,打开“安全性和隐私”,将“允许从以下位置下载的应用程序”设置为“任何来源“.当然,这个设置已经无法在Mac OS Sierra上完成了. 在Mac ...

  4. ES6变量的解构赋值(一)数组的解构赋值

    let[a,...arr]=[1,2,3,4];//a==>1 arr==>[2,3,4] let [x, y, ...z] = ['a'];//a==>'a' y==>und ...

  5. 个人项目-WC(C/C++ 兼容Linux和Windows)

    一.Github地址 https://github.com/S-TRAVELER/WC 实现的功能: 支持 -c 支持 -w 支持 -l 支持 -s 支持 -a 图形界面 多参数(文件名或通配符表达式 ...

  6. Redis 找出大 key

    系统: CentOS 7.4 64bit yum install python-pip gcc gcc-c++ python-devel git tmux -y pip install rdbtool ...

  7. 向busybox中添加自己的applet

    关键词:buysbox.applet等. busybox常用于嵌入式环境,集成中断Linux命令和工具.这些工具简单高效. 下面从如下方面了解: 这些命令是一个软链接到busybox,那么是如何从软连 ...

  8. 快速破解Goland

    两种激活方式永久激活:推荐优先使用,永久有效有效期激活:如果你实在激活不了又着急使用,这是备选激活方案,简单快捷 一.永久激活 1.下载新版破解补丁 点击链接 https://pan.baidu.co ...

  9. 使用scale等比例缩放图片

    功能需求: 在下拉框中选择你所需要缩放的比例, 选择好了之后,图片会按照你选择的比例进行缩放 1==>如何获取select中option选中的值 在select添加事件change 和双向绑定v ...

  10. What is Market Intelligence and how is it Used?

    https://blog.globalwebindex.com/marketing/market-intelligence/ Market intelligence is the gathering ...