iOS之出现( linker command failed with exit code 1)错误总结
本文出自:http://blog.csdn.NET/hengshujiyi/article/details/21182813
补充:我出现这个错误是一个工程中有两个同名的文件,只要删除掉一个就好了,可能是从文件夹中倒文件是出现了重复导入的错误。
这种问题,通常出现在添加第三方库文件或者多人开发时。
这种问题一般是找不到文件而导致的链接错误。 我们可以从如下几个方面着手排查。
1.以如下错误为例,如果是多人开发,你同步完成后发现出现如下的错误。
- Undefined symbols for architecture armv7:
- "_OBJC_CLASS_$_MyPageLogViewController", referenced from:
- objc-class-ref in BaiduMobStatAppDelegate.o
- ld: symbol(s) not found for architecture armv7
- 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文件)
- Undefined symbols for architecture armv7:
- "_OBJC_CLASS_$_BaiduMobStat", referenced from:
- objc-class-ref in BaiduMobStatAppDelegate.o
- objc-class-ref in MyPageLogViewController.o
- (maybe you meant: _OBJC_CLASS_$_BaiduMobStatAppDelegate)
- ld: symbol(s) not found for architecture armv7
- 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)错误总结的更多相关文章
- 运行代码时报linker command failed with exit code 1 错误
一个c语言项目,在.h文件中原来只有一些方法的声明,后来我加入了一些变量声明后,编译的时候报错: 运行代码时报linker command failed with exit code 1 错误 怎么回 ...
- 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.引用出 ...
- ios clang: error: linker command failed with exit code 1 (use -v to see invocation)解决方法
当xcode编译时出现这个错误,一般是你的编译源码中存在重复的源码 解决方法:"Build Phases" -> "Compile Sources" 去删 ...
- [问题]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一
今天添加了一个新类(包括m,h,xib文件),还没有调用,-编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...
- [报错]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一
今天添加了一个新类(包括m,h,xib文件),还没有调用,—编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...
- 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/ ...
- iOS开发——打包报错error: linker command failed with exit code 1
真机运行没问题,打包报错: clang: error: linker command failed with exit code 1 (use -v to see invocation) 原因:在Xc ...
- 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 ...
- iOS出现 _OBJC_CLASS_$_ZSHomeServiceDataElementGroupLargeImage", referenced from:以及linker command failed with exit code 1 (use -v to see invocation)的错误分析
先说第一个问题 出现这样的错误我总结的原因有两个,我碰到过的: 1.文件重命名,在你创建文件的时候重名了 2.如果你是在一个类中又创建了一个或者多个类,那么你可能没有实现你写的类,也就是你只是@int ...
随机推荐
- 全局数据 GetGlobalDataSet
/// <summary> /// 获取全局数据 /// </summary> /// <returns></returns> public DataS ...
- 一个C#后台调用接口的例子
string url = ConfigurationSettings.AppSettings["resurl"].ToString(); var wc = new WebClien ...
- intent 活动之间穿梭
1.从当前activity,跳转到当前应用程序的activity Intent intent = new Intent(MainActivity.this, Intent2Activity.class ...
- 封装http请求键值对的js函数
//封装http请求键值对的函数 function Map() { this.keys = new Array(); this.data = {}; //添加键值对 this.put = functi ...
- TortoiseSVN安装
安装说明 开发人员强烈建议使用IDE中的SVN插件更加智能与人性化. 首先安装SVN客户端,windows一般选择乌龟客户端https://tortoisesvn.net/downloads.html ...
- JSON初试
本次在课堂上老师教我使用JSON. 本次的教学网站是:https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON?td ...
- How can I use Server.MapPath() from global.asax?
引用: using System.Web.Hosting; string filePathcsv = ""; string file = ""; string ...
- js时间与时间戳之间的转换操作,返回天、小时、分,全家桶
1.将时间戳转换成时间 var formatDate = function(d) { var now = new Date(d); var year = now.getFullYear(); var ...
- 《ArcGIS Runtime SDK for Android开发笔记》——(13)、图层扩展方式加载Google地图
1.前言 http://mt2.google.cn/vt/lyrs=m@225000000&hl=zh-CN&gl=cn&x=420&y=193&z=9& ...
- Android SDK 目录和作用详解
1.add-ons这里面保存着附加库,比如GoogleMaps,当然你如果安装了OphoneSDK,这里也会有一些类库在里面.也可以是厂商自己制作的add-ons.开发中该文件是可选的,如果你没有用到 ...