添加第三方类库造成的Undefined symbols for architecture i386:编译错误

1.原因:
如果是源码编译的话,一般就只某些头文件没有添加到src编译里面。但是对于添加库编译,一般是库的编译路径设置不正确(比如arm的版本、模拟器或者真机的不同版本库引用错误或者重复引用一起编译器不知道如何选择)、或者库没有添加到lib path中。

2.解决:
2.1对于外部库真机和模拟器的库引用重复,可以参考
http://blog.csdn.net/forlong401/article/details/9304883
2.2 如果这些库是系统自带库,那就是在Build Phases的link binary with libraries里面添加即可。


3.参考(虽然很多写的都不太正确,但是可以参考一下):

http://my.csdn.net/kaixinnow2008/code/detail/4209

解决方法:
先点击方案(左边列表,点击方案的图示)
选择target
选择页签Build Phases
Compile Source
如果没展开的话先展开
向下找加号,点击加号,将这个target需要的.m档案的头文件都加入吧
(如果只有一个 就把左右的.h档案都加入)
这样就应该可以了

http://blog.csdn.net/itianyi/article/details/8499504

1,如何解决XCODE中错误: Undefined symbols for architecture i386 error

出现Undefined symbols for architecture i386这种错误一般是你用模拟器作为目标,但编译的时候找不到相关的库文件,需要做的就是把库文件所在的位置添加到library search path中。

其它原因可参考下面网址:http://stackoverflow.com/questions/6984368/undefined-symbols-for-architecture-i386-objc-class-skpsmtpmessage-refere    

还有另外一个:http://stackoverflow.com/questions/6610709/undefined-symbols-for-architecture-i386


2,Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error

答案:You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually.

   3,请问为什么在link with lib 种添加  libxml2.dylb  后  引用不了<libxml/tree.h>  老是找不到头文件?

答案:XCODE ,  Project -> Edit Project Settings -> Build Settings

You need to add “/usr/include/libxml2″ to the “Header Search Paths” and you need to add “-lxml2″ to the “Other Linker Flags”.
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值