-
出现(
linker command
failed with exit code 1
)错误总结
这种问题,通常出现在添加第三方库文件或者多人开发
时。
这种问题一般是找不到文件而导致的链接错误。
我们可以
从如下几个方面着手排查。
1.
以如下错误为例,如果是多人
开发,你同步完成后发现出现如下的错误。<
/p>
[html] view
plaincopyUndefined symbols for
architecture armv7:
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)
错误中出现了“
MyPageLog
ViewController
”这个类,你可以
找到这个类的
.m
文件,
查看他的
Target
Membeship
,
如下
图如果没有勾选上,点击勾选。然后编译查看。
2.
< br>如果是新
添加的第三方库,且不是静态库
先重复第一步过程,然后找到
Build
settings->Linking->Other Linker
Flags
将此属性修改成
-all_load
或者
-ObjC
,这个视情况而定。总之可以多试几
次。
3.
如果添加的是第三方静态库(
.a
文件)
[html] view
plaincopyUndefined symbols for
architecture armv7:
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
类和
MyPageLogViewC
ontroller
类这种情况就可能是这个静态库路径混乱导致的链接错误
解决方法:
Build
settings->Search Path->Library Search
Paths
添加静态库的相应路径
。
如下图如果上面的所有方法
都不管用。你可以再试试一下几个
方法:
-
-
-
-
-
-
-
-
-
上一篇:ccs编译错误
下一篇:毛织基本知识3-缝挑